70 public static function main()
102 switch ($this->_mode) {
166 $homeDirectory =
null;
168 $homeDirectory = getenv(
'ZF_HOME');
169 if ($homeDirectory) {
170 $this->
_logMessage(
'Home directory found in environment variable ZF_HOME with value ' . $homeDirectory, $returnMessages);
171 if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
172 return $homeDirectory;
174 $this->
_logMessage(
'Home directory does not exist at ' . $homeDirectory, $returnMessages);
178 $homeDirectory = getenv(
'HOME');
180 if ($homeDirectory) {
181 $this->
_logMessage(
'Home directory found in environment variable HOME with value ' . $homeDirectory, $returnMessages);
182 if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
183 return $homeDirectory;
185 $this->
_logMessage(
'Home directory does not exist at ' . $homeDirectory, $returnMessages);
190 $homeDirectory = getenv(
'HOMEPATH');
192 if ($homeDirectory) {
193 $this->
_logMessage(
'Home directory found in environment variable HOMEPATH with value ' . $homeDirectory, $returnMessages);
194 if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
195 return $homeDirectory;
197 $this->
_logMessage(
'Home directory does not exist at ' . $homeDirectory, $returnMessages);
201 $homeDirectory = getenv(
'USERPROFILE');
203 if ($homeDirectory) {
204 $this->
_logMessage(
'Home directory found in environment variable USERPROFILE with value ' . $homeDirectory, $returnMessages);
205 if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
206 return $homeDirectory;
208 $this->
_logMessage(
'Home directory does not exist at ' . $homeDirectory, $returnMessages);
224 $storageDirectory =
false;
226 $storageDirectory = getenv(
'ZF_STORAGE_DIR');
227 if ($storageDirectory) {
228 $this->
_logMessage(
'Storage directory path found in environment variable ZF_STORAGE_DIR with value ' . $storageDirectory, $returnMessages);
229 if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
230 return $storageDirectory;
232 $this->
_logMessage(
'Storage directory does not exist at ' . $storageDirectory, $returnMessages);
238 if ($homeDirectory) {
239 $storageDirectory = $homeDirectory .
'/.zf/';
240 $this->
_logMessage(
'Storage directory assumed in home directory at location ' . $storageDirectory, $returnMessages);
241 if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
242 return $storageDirectory;
244 $this->
_logMessage(
'Storage directory does not exist at ' . $storageDirectory, $returnMessages);
262 $configFile = getenv(
'ZF_CONFIG_FILE');
264 $this->
_logMessage(
'Config file found environment variable ZF_CONFIG_FILE at ' . $configFile, $returnMessages);
265 if (!$mustExist || ($mustExist && file_exists($configFile))) {
268 $this->
_logMessage(
'Config file does not exist at ' . $configFile, $returnMessages);
273 if ($homeDirectory) {
274 $configFile = $homeDirectory .
'/.zf.ini';
275 $this->
_logMessage(
'Config file assumed in home directory at location ' . $configFile, $returnMessages);
276 if (!$mustExist || ($mustExist && file_exists($configFile))) {
279 $this->
_logMessage(
'Config file does not exist at ' . $configFile, $returnMessages);
284 if ($storageDirectory) {
285 $configFile = $storageDirectory .
'/zf.ini';
286 $this->
_logMessage(
'Config file assumed in storage directory at location ' . $configFile, $returnMessages);
287 if (!$mustExist || ($mustExist && file_exists($configFile))) {
290 $this->
_logMessage(
'Config file does not exist at ' . $configFile, $returnMessages);
306 ini_set(
'display_errors',
true);
309 $cwd = getenv(
'ZEND_TOOL_CURRENT_WORKING_DIRECTORY');
310 if ($cwd !=
'' && realpath($cwd)) {
314 if (!$this->_configFile) {
317 $zfINISettings = parse_ini_file($this->_configFile);
318 $phpINISettings = ini_get_all();
319 foreach ($zfINISettings as $zfINIKey => $zfINIValue) {
320 if (substr($zfINIKey, 0, 4) ===
'php.') {
321 $phpINIKey = substr($zfINIKey, 4);
322 if (array_key_exists($phpINIKey, $phpINISettings)) {
323 ini_set($phpINIKey, $zfINIValue);
338 $includePathPrepend = getenv(
'ZEND_TOOL_INCLUDE_PATH_PREPEND');
339 $includePathFull = getenv(
'ZEND_TOOL_INCLUDE_PATH');
342 if (!($includePathPrepend || $includePathFull)) {
349 if ($includePathPrepend || $includePathFull) {
350 if (isset($includePathPrepend) && ($includePathPrepend !==
false)) {
351 set_include_path($includePathPrepend . PATH_SEPARATOR . get_include_path());
352 }
elseif (isset($includePathFull) && ($includePathFull !==
false)) {
353 set_include_path($includePathFull);
361 $zfIncludePath[
'relativePath'] = dirname(
__FILE__) .
'/../library/';
362 if (file_exists($zfIncludePath[
'relativePath'] .
'Zend/Tool/Framework/Client/Console.php')) {
363 set_include_path(realpath($zfIncludePath[
'relativePath']) . PATH_SEPARATOR . get_include_path());
367 $this->_mode =
'runError';
382 $this->_clientLoaded =
false;
383 $fh = @
fopen(
'Zend/Tool/Framework/Client/Console.php',
'r',
true);
389 include
'Zend/Tool/Framework/Client/Console.php';
390 $this->_clientLoaded =
class_exists(
'Zend_Tool_Framework_Client_Console');
407 *****************************
ZF ERROR ********************************
408 In order to
run the zf command, you need to ensure that
Zend Framework
409 is inside your include_path. There are a variety of ways that you can
410 ensure that
this zf command line tool knows where the
Zend Framework
411 library is
on your system, but not all of them can be described here.
413 The easiest way to
get the zf command running is to give it the include
414 path via an environment variable ZEND_TOOL_INCLUDE_PATH or
415 ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
416 then
run the command
"zf --setup". This command is designed to create
417 a storage location
for your user, as well as create the zf.ini file
418 that the zf command will consult in order to
run properly
on your
421 Example you would
run:
423 $ ZEND_TOOL_INCLUDE_PATH=/path/to/library zf --setup
425 Your are encourged to read more in the link that follows.
439 echo
'Zend_Tool & CLI Setup Information' . PHP_EOL
440 .
'(available via the command line "zf --info")' 443 echo
' * ' . implode(PHP_EOL .
' * ', $this->_messages) . PHP_EOL;
447 echo
'To change the setup of this tool, run: "zf --setup"';
460 $setupCommand = (isset($_SERVER[
'argv'][2])) ? $_SERVER[
'argv'][2] :
null;
462 switch ($setupCommand) {
463 case 'storage-directory':
484 if (file_exists($storageDirectory)) {
485 echo
'Directory already exists at ' . $storageDirectory . PHP_EOL
486 .
'Cannot create storage directory.';
490 mkdir($storageDirectory);
492 echo
'Storage directory created at ' . $storageDirectory . PHP_EOL;
504 if (file_exists($configFile)) {
505 echo
'File already exists at ' . $configFile . PHP_EOL
506 .
'Cannot write new config file.';
510 $includePath = get_include_path();
512 $contents =
'php.include_path = "' . $includePath .
'"';
516 $iniValues = ini_get_all();
517 if ($iniValues[
'include_path'][
'global_value'] != $iniValues[
'include_path'][
'local_value']) {
518 echo
'NOTE: the php include_path to be used with the tool has been written' . PHP_EOL
519 .
'to the config file, using ZEND_TOOL_INCLUDE_PATH (or other include_path setters)' . PHP_EOL
520 .
'is no longer necessary.' . PHP_EOL . PHP_EOL;
523 echo
'Config file written to ' . $configFile . PHP_EOL;
539 ZF Command Line Tool - Setup
540 ----------------------------
542 Current Paths (Existing or not):
543 Home Directory: {$homeDirectory}
544 Storage Directory: {$storageDirectory}
545 Config File: {$configFile}
547 Important Environment Variables:
549 - the directory
this tool will look
for a home directory
550 - directory must exist
552 - where
this tool will look
for a storage directory
553 - directory must exist
555 - where
this tool will look
for a configuration file
557 -
set the include_path
for this tool to use
this value 558 ZF_TOOL_INCLUDE_PATH_PREPEND
559 - prepend the current php.ini include_path with
this value 563 - ZF_HOME, then HOME (*nix), then HOMEPATH (windows)
565 - ZF_STORAGE_DIR, then {home}/.zf/
567 - ZF_CONFIG_FILE, then {home}/.zf.ini, then {home}/zf.ini,
568 then {storage}/zf.ini
571 zf --setup storage-directory
572 - setup the storage directory, directory will be created
573 zf --setup config-file
574 - create the config file with some
default values
588 $configOptions = array();
589 if (isset($this->_configFile) && $this->_configFile) {
592 if (isset($this->_storageDirectory) && $this->_storageDirectory) {
597 $configOptions[
'classesToLoad'] =
'Zend_Tool_Project_Provider_Manifest';
599 $console =
new Zend_Tool_Framework_Client_Console($configOptions);
600 $console->dispatch();
612 if (!$storeMessage) {
622 if (!getenv(
'ZF_NO_MAIN')) {
_runSetupStorageDirectory()
_detectStorageDirectory($mustExist=true, $returnMessages=true)
_detectHomeDirectory($mustExist=true, $returnMessages=true)
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
ini_set($varName, $newValue)
elseif(isset( $params[ 'redirect_parent']))
_logMessage($message, $storeMessage=true)
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
taxRateField this edit on("click.mselect-delete", ".mselect-delete", function() { if(!confirm('<?=/*@escapeNotVerified */__( 'Do you really want to delete this tax rate?') ?>')) { return;} var that=$(this), select=that.closest('.mselect-list').prev(), rateValue=that.parent().find( 'input[type="checkbox"]').val();$( 'body').trigger( 'processStart');var ajaxOptions={ type:'POST', data:{ tax_calculation_rate_id:rateValue, form_key:$( 'input[name="form_key"]').val() }, dataType:'json', url:'<?=/*@escapeNotVerified */$block->getTaxRateDeleteUrl() ?>', success:function(result, status) { $( 'body').trigger( 'processStop');if(result.success) { that.parent().remove();select.find( 'option').each(function() { if(this.value===rateValue) { $(this).remove();} });select.trigger( 'change.hiddenSelect');} else { if(result.error_message) alert({ content:result.error_message });else alert({ content:'<?=/*@escapeNotVerified */__( 'An error occurred') ?>' });} }, error:function() { $( 'body').trigger( 'processStop');alert({ content:'<?=/*@escapeNotVerified */__( 'An error occurred') ?>' });} };$.ajax(ajaxOptions);}) .on( 'click.mselectAdd'
mkdir($pathname, $mode=0777, $recursive=false, $context=null)
_detectConfigFile($mustExist=true, $returnMessages=true)