本文整理汇总了PHP中eZScript类的典型用法代码示例。如果您正苦于以下问题:PHP eZScript类的具体用法?PHP eZScript怎么用?PHP eZScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZScript类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->cli = new \QuestionInteractiveCli();
$this->script = \eZScript::instance( array(
'description' => "Debug (auto)login",
'use-modules' => true,
'use-extensions' => true,
'debug-output' => false,
) );
$this->script->startup();
$this->script->initialize();
$this->options = $this->script->getOptions( "[type:][nlt:][frq:]", array(
'type' => 'Type of action (login|autologin)',
'nlt' => 'Newsletter type [news|education]',
'frq' => 'Frequency [daily|ẁeekly|monthly]'
) );
$clusterDomains = \eZINI::instance( 'merck.ini' )->variable( 'DomainMappingSettings', 'ClusterDomains' );
$this->domains = array_flip( $clusterDomains );
}
示例2: array
#!/usr/bin/env php
<?php
/**
* Trash purge script
*
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://ez.no/Resources/Software/Licenses/eZ-Business-Use-License-Agreement-eZ-BUL-Version-2.1 eZ Business Use License Agreement eZ BUL Version 2.1
* @version 4.7.0
* @package kernel
*/
require 'autoload.php';
$script = eZScript::instance(array('description' => "Empty eZ Publish trash.\n" . "Permanently deletes all objects in the trash.\n" . "\n" . "./bin/php/trashpurge.php", 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[iteration-sleep:][iteration-limit:][memory-monitoring]", "", array('iteration-sleep' => 'Amount of seconds to sleep between each iteration when performing a purge operation, can be a float. Default is one second.', 'iteration-limit' => 'Amount of items to remove in each iteration when performing a purge operation. Default is 100.', 'memory-monitoring' => 'If set, memory usage will be logged in var/log/trashpurge.log.'));
$script->initialize();
$script->setIterationData('.', '~');
$purgeHandler = new eZScriptTrashPurge(eZCLI::instance(), false, (bool) $options['memory-monitoring'], $script);
if ($purgeHandler->run($options['iteration-limit'] ? (int) $options['iteration-limit'] : null, $options['iteration-sleep'] ? (int) $options['iteration-sleep'] : null)) {
$script->shutdown();
} else {
$script->shutdown(1);
}
示例3: array
#!/usr/bin/env php
<?php
/**
* File containing the checkdbfiles.php script.
*
* @deprecated and unmaintained since 5.0
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version 2014.11.1
* @package kernel
*/
require_once 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish DB file verifier\n\n" . "Checks the database update files and gives a report on them.\n" . "It will show which files are missing and which should not be present.\n" . "\n" . "For each file with problems it will output a status and the filepath\n" . "The status will be one of these:\n" . " '?' file is not defined in upgrade path\n" . " '!' file defined in upgrade path but missing on filesystem\n" . " 'A' file is present in working copy but not in the original stable branch\n" . " 'C' file data conflicts with the original stable branch\n" . "\n" . "Example output:\n" . " checkdbfiles.php\n" . " ? update/database/mysql/3.5/dbupdate-3.5.0-to-3.5.1.sql", 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[no-verify-branches][export-path:]", "", array('no-verify-branches' => "Do not verify the content of the files with previous branches (To avoid SVN usage)", 'export-path' => "Directory to use for doing SVN exports."));
$script->initialize();
$dbTypes = array();
$dbTypes[] = 'mysql';
$dbTypes[] = 'postgresql';
$branches = array();
$branches[] = '4.1';
$branches[] = '4.2';
$branches[] = '4.3';
$branches[] = '4.4';
// Controls the lowest version which will be exported and verified against current data
$lowestExportVersion = '4.3';
/********************************************************
*** NOTE: The following arrays do not follow the
*** coding standard, the reason for this is
*** to make it easy to merge any changes between
示例4: array
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
* @package
*/
/**
* This script starts parallel publishing processes in order to trigger lock wait timeouts
* Launch it using $./bin/php/ezexec.phhp contentwaittimeout.php
*
* To customize the class, parent node or concurrency level, modify the 3 variables below.
* @package tests
*/
require_once 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish Parallel publishing benchmark", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[b:|batches-count:][c:|content-class:][l:|concurrency-level:][p:|parent-node:][g|generate-content]", "", array('content-class' => "Identifier of the content class used for testing [default: article]", 'concurrency-level' => "Parallel processes to use [default: 20]", 'generate-content' => "Wether content should be generated or not (not fully supported yet) [default: off]", 'parent-node' => "Container content should be created in [default: 2]", 'batches-count' => "How many times a concurrent batch should be started [default: 1]"));
$sys = eZSys::instance();
$script->initialize();
$optParentNode = 2;
$optContentClass = 'article';
$optConcurrencyLevel = 20;
$optGenerateContent = false;
$optQuiet = false;
$optBatchesCount = 1;
if ($options['content-class']) {
$optContentClass = $options['content-class'];
}
if ($options['batches-count']) {
$optBatchesCount = $options['batches-count'];
示例5: foreach
{
global $cli, $fileHandler;
$cli->output("Exporting files from database:");
$filePathList = $fileHandler->getFileList($excludeScopes, true);
foreach ($filePathList as $filePath) {
$cli->output("- " . $filePath);
eZDir::mkdir(dirname($filePath), false, true);
$fileHandler->fileFetch($filePath);
if ($remove) {
$fileHandler->fileDelete($filePath);
}
}
$cli->output();
}
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish (un)clusterize\n" . "Script for moving var_dir files from " . "filesystem to database and vice versa\n" . "\n" . "./bin/php/clusterize.php", 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[u][skip-binary-files][skip-media-files][skip-images][r][n]", "", array('u' => 'Unclusterize', 'skip-binary-files' => 'Skip copying binary files', 'skip-media-files' => 'Skip copying media files', 'skip-images' => 'Skip copying images', 'r' => 'Remove files after copying', 'n' => 'Do not wait'));
$script->initialize();
$clusterize = !isset($options['u']);
$remove = isset($options['r']);
$copyFiles = !isset($options['skip-binary-files']);
$copyMedia = !isset($options['skip-media-files']);
$copyImages = !isset($options['skip-images']);
$wait = !isset($options['n']);
if ($wait) {
$warningMsg = sprintf("This script will now %s your files and/or images %s database.", $remove ? "move" : "copy", $clusterize ? 'to' : 'from');
$cli->warning($warningMsg);
$cli->warning("You have 10 seconds to break the script (press Ctrl-C).");
sleep(10);
}
示例6: array
#!/usr/bin/env php
<?php
/**
* File containing the ezsqldumpschema.php script.
*
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2012.8
* @package kernel
*/
require 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish SQL Schema dump\n\n" . "Dump sql schema to specified file or standard output\n" . "ezsqldumpschema.php --type=mysql --user=root stable33 schema.sql", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[type:][user:][host:][password;][port:][socket:][output-array][output-serialized][output-sql]" . "[diff-friendly][meta-data][table-type:][table-charset:][compatible-sql][no-sort]" . "[format:]" . "[output-types:][allow-multi-insert][schema-file:]", "[database][filename]", array('type' => "Which database type to use for source, can be one of:\n" . "mysql, postgresql, oracle", 'host' => "Connect to host source database", 'user' => "User for login to source database", 'password' => "Password to use when connecting to source database", 'port' => 'Port to connect to source database', 'socket' => 'Socket to connect to match and source database (only for MySQL)', 'output-array' => 'Create file with array structures (Human readable)', 'output-serialized' => 'Create file with serialized data (Saves space)', 'output-sql' => 'Create file with SQL data (DB friendly)', 'compatible-sql' => 'Will turn SQL to be more compatible to existing dumps', 'no-sort' => 'Do not sort table columns in the dumped data structure', 'table-type' => "The table storage type to use for SQL output when creating tables.\n" . "MySQL: bdb, innodb and myisam\n" . "PostgreSQL: \n" . "Oracle: ", 'table-charset' => 'Defines the charset to use on tables, the names of the charset depends on database type', 'schema-file' => 'The schema file to use when dumping data structures, is only required when dumping from files', 'format' => "The output format (default is generic)\n" . "generic - Format which suits all databases\n" . "local - Format which suits only the database it was dumped from.", 'meta-data' => 'Will include extra meta-data information specific to the database.', 'diff-friendly' => 'Will make the output friendlier towards the diff command (applies to SQL output only)', 'allow-multi-insert' => 'Will create INSERT statements with multiple data entries (applies to data output only)' . "\n" . 'Multi-inserts will only be created for databases that support it', 'output-types' => "A comma separated list of types to include in dump (default is schema only):\n" . "schema - Table schema\n" . "data - Table data\n" . "all - Both table schema and data"));
$script->initialize();
$type = $options['type'];
$host = $options['host'];
$user = $options['user'];
$port = $options['port'];
$socket = $options['socket'];
$password = $options['password'];
if (!is_string($password)) {
$password = '';
}
switch (count($options['arguments'])) {
case 0:
$cli->error("Missing match database and/or filename");
$script->shutdown(1);
break;
case 1:
示例7: set_time_limit
#!/usr/bin/env php
<?php
/**
* File containing the upgrade script to fix older occurrences of link items
* not being present in the ezurl_object_table for all versions/translations.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*
*/
require 'autoload.php';
set_time_limit(0);
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "Fix older occurrences of link items in XML-blocks, where they might not be\n" . "linked correctly for all versions/translations. This script will update\n" . "these references for existing entries. Note that URLs which have been lost\n" . "already will not be restored in this process, these need to be re-entered.\n" . "\n" . "fixezurlobjectlink.php", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$config = "[fix][fetch-limit:]";
$argConfig = "";
$optionHelp = array("fix" => "Fix missing ezurl-object-link references. This will make sure that URLs\n" . "created with older versions, will not be lost, when older\nversions/translations are removed.", "fetch-limit" => "The number of attributes to fetch in one chunk. Default value is 200,\nthe limit must be higher than 1.");
$arguments = false;
$useStandardOptions = true;
$script->startup();
$options = $script->getOptions($config, $argConfig, $optionHelp, $arguments, $useStandardOptions);
$script->initialize();
$script->setIterationData('.', '+');
$linkUpdate = new ezpUrlObjectLinkUpdate($cli, $script, $options);
$cli->output($cli->stylize('red', "Found ") . $cli->stylize('green', $linkUpdate->xmlTextContentObjectAttributeCount()) . $cli->stylize('red', " occurrences of 'ezxmltext'."));
$cli->output();
$cli->output("Starting to process content object attributes.");
$cli->output("Fetch limit: " . $cli->stylize('green', $linkUpdate->fetchLimit));
$cli->output();
$linkUpdate->processData();
$cli->output();
示例8: __destruct
public function __destruct()
{
if (self::$script instanceof eZScript) {
self::$script->shutdown(0);
}
}
示例9: array
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of version 2.0 of the GNU General
// Public License along with this program; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file
*/
require 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish CSV export script\n" . "\n" . "ezcsvexport.php --storage-dir=export 2", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true, 'user' => true));
$script->startup();
$options = $script->getOptions("[storage-dir:]", "[node]", array('storage-dir' => 'directory to place exported files in'), false, array('user' => true));
$script->initialize();
if (count($options['arguments']) < 1) {
$cli->error('Specify a node to export');
$script->shutdown(1);
}
$nodeID = $options['arguments'][0];
if (!is_numeric($nodeID)) {
$cli->error('Specify a numeric node ID');
$script->shutdown(2);
}
if ($options['storage-dir']) {
$storageDir = $options['storage-dir'];
} else {
示例10: array
* @license http://ez.no/Resources/Software/Licenses/eZ-Business-Use-License-Agreement-eZ-BUL-Version-2.1 eZ Business Use License Agreement eZ BUL Version 2.1
* @version 4.7.0
* @package kernel
*/
/**
* This script updates the different ranges used by the ISBN standard to
* calculate the length of Registration group, Registrant and Publication element
*
* It gets the values from xml file normally provided by International ISBN Agency
* http://www.isbn-international.org/agency?rmxml=1
*/
require 'autoload.php';
$url = '';
// http://www.isbn-international.org/agency?rmxml=1 url with the xml.
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish ISBN-13 update\n\n" . "Update the database with new updated ISBN data to the database.", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[url:][db-host:][db-user:][db-password:][db-database:][db-driver:]", "", array('url' => "URL containing the xml file for the different ranges", 'db-host' => "Database host.", 'db-user' => "Database user.", 'db-password' => "Database password.", 'db-database' => "Database name.", 'db-driver' => "Database driver."));
$script->initialize();
if (isset($options['url'])) {
$url = $options['url'];
} else {
$cli->error('Error: you need to specify a url to the xml file containing the ranges');
$script->shutdown(1);
}
$db = eZDB::instance();
if (!$db->IsConnected) {
// default settings are not valid
// try user-defined settings
$dbUser = $options['db-user'] ? $options['db-user'] : false;
$dbPassword = $options['db-password'] ? $options['db-password'] : false;
示例11: array
#!/usr/bin/env php
<?php
/**
* File containing the script to cleanup files in a DFS setup
*
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
* @package
*/
require_once 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "Script for checking database and DFS file consistency", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[S][B][D][path:][iteration-limit:]", "", array("D" => "Delete nonexistent files", "S" => "Check files on DFS share against files in the database", "B" => "Checks files in database against files on DFS share", "path" => "Path to limit checks to (e.g.: var/storage/content - Default: var/)", "iteration-limit" => "Amount of items to remove in each iteration when performing a purge operation. Default is all in one iteration."));
$script->initialize();
$fileHandler = eZClusterFileHandler::instance();
if (!$fileHandler instanceof eZDFSFileHandler) {
$cli->error("Your installation does not use DFS clustering.");
$script->shutdown(2);
}
$delete = isset($options['D']);
$checkBase = isset($options['S']);
$checkDFS = isset($options['B']);
if (isset($options['path'])) {
$checkPath = trim($options['path']);
} else {
$checkPath = eZINI::instance()->variable('FileSettings', 'VarDir');
}
$optIterationLimit = isset($options['iteration-limit']) ? (int) $options['iteration-limit'] : false;
$pause = 1000;
示例12: array
#!/usr/bin/env php
<?php
/**
* File containing the section identifier upgrade script.
*
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2013.11
* @package update
*/
require 'autoload.php';
$script = eZScript::instance(array('description' => 'eZ Publish section identifier update script. ' . 'This script will update existing sections with missing identifiers.', 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions('', '', array('-q' => 'Quiet mode'));
$script->initialize();
$cli = eZCLI::instance();
$trans = eZCharTransform::instance();
// Fetch 50 items per iteration
$limit = 50;
$offset = 0;
do {
// Fetch items with empty identifier
$rows = eZSection::fetchFilteredList(null, $offset, $limit);
if (!$rows) {
break;
}
foreach ($rows as $row) {
if ($row->attribute('identifier') == '') {
// Create a new section identifier with NAME_ID pattern
$name = $row->attribute('name');
$identifier = $trans->transformByGroup($name, 'identifier') . '_' . $row->attribute('id');
示例13: childHandler
/**
* Signal handler
* @param int $signo Signal number
*/
function childHandler($signo)
{
switch ($signo) {
case SIGALRM:
eZScript::instance()->shutdown(1);
break;
case SIGUSR1:
eZScript::instance()->shutdown(0);
break;
case SIGCHLD:
eZScript::instance()->shutdown(1);
break;
}
}
示例14: array
#!/usr/bin/env php
<?php
/**
* File containing the ezsqldiff.php script.
*
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2013.11
* @package kernel
*/
require_once 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish SQL diff\n\n" . "Displays differences between two database schemas,\n" . "and sets exit code based whether there is a difference or not\n" . "\n" . "ezsqldiff.php --type mysql --user=root stable32 stable33", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[source-type:][source-host:][source-user:][source-password;][source-socket:]" . "[match-type:][match-host:][match-user:][match-password;][match-socket:]" . "[t:|type:][host:][u:|user:][p:|password;][socket:]" . "[lint-check]" . "[reverse][check-only]", "[source][match]", array('source-type' => "Which database type to use for source, can be one of:\n" . "mysql, postgresql", 'source-host' => "Connect to host source database", 'source-user' => "User for login to source database", 'source-password' => "Password to use when connecting to source database", 'source-socket' => 'Socket to connect to source database (only for MySQL)', 'match-type' => "Which database type to use for match, can be one of:\n" . "mysql, postgresql", 'match-host' => "Connect to host match database", 'match-user' => "User for login to match database", 'match-password' => "Password to use when connecting to match database", 'match-socket' => 'Socket to connect to match database (only for MySQL)', 'type' => "Which database type to use for match and source, can be one of:\n" . "mysql, postgresql", 'host' => "Connect to host match and source database", 'user' => "User for login to match and source database", 'password' => "Password to use when connecting to match and source database", 'socket' => 'Socket to connect to match and source database (only for MySQL)', 'lint-check' => 'Instead of comparing 2 datase schemas, verify source database schema for standards compliance', 'reverse' => "Reverse the differences", 'check-only' => "Don't show SQLs for the differences, just set exit code and return"));
$script->initialize();
if (count($options['arguments']) < 1) {
$cli->error("Missing source database");
$script->shutdown(1);
}
if (count($options['arguments']) < 2 and !$options['lint-check']) {
$cli->error("Missing match database");
$script->shutdown(1);
}
$sourceType = $options['source-type'] ? $options['source-type'] : $options['type'];
$sourceDBHost = $options['source-host'] ? $options['source-host'] : $options['host'];
$sourceDBUser = $options['source-user'] ? $options['source-user'] : $options['user'];
$sourceDBPassword = $options['source-password'] ? $options['source-password'] : $options['password'];
$sourceDBSocket = $options['source-socket'] ? $options['source-socket'] : $options['socket'];
$sourceDB = $options['arguments'][0];
if (!is_string($sourceDBPassword)) {
示例15: set_time_limit
* @version 4.7.0
* @package kernel
*/
require 'autoload.php';
set_time_limit( 0 );
$cli = eZCLI::instance();
$endl = $cli->endlineString();
$script = eZScript::instance( array( 'description' => ( "eZ Publish database cleanup.\n\n" .
"Will cleanup various data from the currently used database in eZ Publish\n" .
"\n" .
"Possible values for NAME is:\n" .
"session, expired_session, preferences, browse, tipafriend, shop, forgotpassword, workflow,\n" .
"collaboration, collectedinformation, notification, searchstats or all (for all items)\n" .
"cleanup.php -s admin session"),
'use-session' => false,
'use-modules' => true,
'use-extensions' => true ) );
$script->startup();
$options = $script->getOptions( "[db-host:][db-user:][db-password:][db-database:][db-type:|db-driver:][sql]",
"[name]",
array( 'db-host' => "Database host",
'db-user' => "Database user",
'db-password' => "Database password",
'db-database' => "Database name",
'db-driver' => "Database driver",
'db-type' => "Database driver, alias for --db-driver",