Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_Tx_Cmd_Storage class

AMI_Tx_Cmd
   |
   --AMI_Tx_Cmd_Storage

• Introduction

Abstract storage transaction command.

• Class synopsis

AMI_Tx_Cmd_Storage extends AMI_Tx_Cmd {
/* Properties */
// Flag specifies if previous file was backuped
protected bool $backuped = FALSE;
// Path for backup file
protected string $backupPath;
// EOL style for conent modifiers
protected string $eol = "\r\n";
// Storage driver
protected AMI_iStorage $oStorage;
/* Inherited Properties */
// Backup name
// Command arguments
protected AMI_Tx_Cmd::$oArgs;
// Current transaction object
protected AMI_Tx_Cmd::$oTx;
// Flag specifying to replace original file on commit
protected AMI_Tx_Cmd::$replaceOnCommit = TRUE;
/* Methods */
// Adds resources of available commands.
public static addResources ( ) returns void;
// Commits command.
public commit ( ) returns void;
// Rollbacks command.
public rollback ( ) returns void;
// Backups target file.
protected backup ( ) returns void;
// Copies source to target file.
protected copy ( ) returns void;
// Initializes command.
protected init ( ) returns void;
// Sets target file content.
protected set ( [ string $content = null ] ) returns void;
// Validates passed arguments.
protected validateArgs ( ) returns void;
/* Inherited Methods */
// Constructor.
public AMI_Tx_Cmd::__construct ( $oTx, AMI_Tx_Cmd_Args $oArgs ) returns AMI_Tx_Cmd;
// Returns string containing argements for logging.
public AMI_Tx_Cmd::getLoggingArgs ( ) returns string;
// Returns string containing specifying arguments and values.
protected AMI_Tx_Cmd::argsToString ( [ $aArgs = array() ] ) returns string;
// Initializes command.
protected AMI_Tx_Cmd::init ( ) returns void;
// Runs command.
protected AMI_Tx_Cmd::run ( ) returns void;
// Validates passed arguments.
protected AMI_Tx_Cmd::validateArgs ( ) returns void;
// Validates obligatory arguments.
protected AMI_Tx_Cmd::validateObligatoryArgs ( $aArgs ) returns void;
}

• Class Details

Expects in $oArgs constructor arguments:
  • mode - command execustion mode (AMI_iTx_Cmd::MODE_* constants);
  • source - source file path;
  • target - target file path;
  • content - (optional) content to set by AMI_Tx_Cmd_FS::set().
Tags:
see AMI_iStorage
abstract
since 6.0.2

• Class Properies

protected bool $backuped

Flag specifies if previous file was backuped

protected string $backupPath

Path for backup file

protected string $eol

EOL style for conent modifiers

protected AMI_iStorage $oStorage

Storage driver

• Class Methods

// Adds resources of available commands.
public static addResources ( ) returns void;
// Commits command.
public commit ( ) returns void;

Overridden in child classes as: AMI_Tx_Cmd_Storage_Cleaner::commit().

Called after all commands finished successfully.
// Rollbacks command.
public rollback ( ) returns void;
Called on transaction exception cought.
Tags:
throws AMI_Tx_Exception In case of problems.
// Backups target file.
protected backup ( ) returns void;
Tags:
throws AMI_Tx_Exception In case of problems.
// Copies source to target file.
protected copy ( ) returns void;
Tags:
throws AMI_Tx_Exception In case of problems.
// Sets target file content.
protected set ( [ string $content = null ] ) returns void;
  • string $content
    Content to set
Tags:
throws AMI_Tx_Exception In case of problems.