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

The AMI_Tx_Cmd_Storage_ContentSetter class

AMI_Tx_Cmd
   |
   --AMI_Tx_Cmd_Storage
      |
      --AMI_Tx_Cmd_Storage_ContentSetter

• Introduction

Storage content setter transaction command.

• Class synopsis

AMI_Tx_Cmd_Storage_ContentSetter extends AMI_Tx_Cmd_Storage {
/* Inherited Properties */
// Flag specifies if previous file was backuped
protected AMI_Tx_Cmd_Storage::$backuped = FALSE;
// Path for backup file
// EOL style for conent modifiers
protected AMI_Tx_Cmd_Storage::$eol = "\r\n";
// Storage driver
// 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 */
// Runs command.
protected run ( ) returns void;
/* Inherited Methods */
// Adds resources of available commands.
public static AMI_Tx_Cmd_Storage::addResources ( ) returns void;
// Commits command.
public AMI_Tx_Cmd_Storage::commit ( ) returns void;
// Rollbacks command.
public AMI_Tx_Cmd_Storage::rollback ( ) returns void;
// Backups target file.
protected AMI_Tx_Cmd_Storage::backup ( ) returns void;
// Copies source to target file.
protected AMI_Tx_Cmd_Storage::copy ( ) returns void;
// Initializes command.
protected AMI_Tx_Cmd_Storage::init ( ) returns void;
// Sets target file content.
protected AMI_Tx_Cmd_Storage::set ( [ string $content = null ] ) returns void;
// Validates passed arguments.
protected AMI_Tx_Cmd_Storage::validateArgs ( ) returns void;
// 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

Sets content to target. Example:
  •  // "install_after.php" / "install.php" context
  •  
  •  $srcPath dirname(__FILE__'/';
  •  $destPath AMI_Registry::get('path/root''_local/';
  •  
  •  $oStorage AMI::getResource('storage/fs');
  •  
  •  $file 'ami_redirect.php';
  •  // Load PHP-code template file
  •  $content $oStorage->load($srcPath $file);
  •  // Replace ##modId## by instance id
  •  $content str_replace('##modId##'$this->oArgs->modId$content);
  •  // Save file with PHP-code
  •  
  •  $oArgs new AMI_Tx_Cmd_Args(
  •      array(
  •          // Installation mode
  •          'mode'     => $this->oArgs->mode,
  •          // New file content
  •          'content'  => $content,
  •          // Target file path
  •          'target'   => $destPath $file,
  •          // Storage driver
  •          'oStorage' => $oStorage
  •      )
  •  );
  •  $this->aTx['storage']->addCommand('storage/set'$oArgs);
  •  
  •  // File 'ami_redirect.php' contains PHP code starting from opening PHP tag
Tags:
resource tx/cmd/storage/set AMI::getResource('tx/cmd/storage/set')
since 6.0.2

• Class Methods

// Runs command.
protected run ( ) returns void;

Overrides: AMI_Tx_Cmd::run().