本文整理匯總了PHP中eZContentObjectVersion::removeVersions方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentObjectVersion::removeVersions方法的具體用法?PHP eZContentObjectVersion::removeVersions怎麽用?PHP eZContentObjectVersion::removeVersions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentObjectVersion
的用法示例。
在下文中一共展示了eZContentObjectVersion::removeVersions方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
$ini = eZINI::instance('content.ini');
$internalDraftsCleanUpLimit = $ini->hasVariable('VersionManagement', 'InternalDraftsCleanUpLimit') ? $ini->variable('VersionManagement', 'InternalDraftsCleanUpLimit') : 0;
$durationSetting = $ini->hasVariable('VersionManagement', 'InternalDraftsDuration') ? $ini->variable('VersionManagement', 'InternalDraftsDuration') : array('hours' => 24);
// by default, only remove drafts older than 1 day
$isDurationSet = false;
$duration = 0;
if (is_array($durationSetting)) {
if (isset($durationSetting['days']) and is_numeric($durationSetting['days'])) {
$duration += $durationSetting['days'] * 60 * 60 * 24;
$isDurationSet = true;
}
if (isset($durationSetting['hours']) and is_numeric($durationSetting['hours'])) {
$duration += $durationSetting['hours'] * 60 * 60;
$isDurationSet = true;
}
if (isset($durationSetting['minutes']) and is_numeric($durationSetting['minutes'])) {
$duration += $durationSetting['minutes'] * 60;
$isDurationSet = true;
}
if (isset($durationSetting['seconds']) and is_numeric($durationSetting['seconds'])) {
$duration += $durationSetting['seconds'];
$isDurationSet = true;
}
}
if ($isDurationSet) {
$expiryTime = time() - $duration;
$processedCount = eZContentObjectVersion::removeVersions(eZContentObjectVersion::STATUS_INTERNAL_DRAFT, $internalDraftsCleanUpLimit, $expiryTime);
$cli->output("Cleaned up " . $processedCount . " internal drafts");
} else {
$cli->output("Lifetime is not set for internal drafts (see your ini-settings, content.ini, VersionManagement section).");
}
示例2: array
// Cleaning up usual drafts
$ini = eZINI::instance('content.ini');
$draftsCleanUpLimit = $ini->hasVariable('VersionManagement', 'DraftsCleanUpLimit') ? $ini->variable('VersionManagement', 'DraftsCleanUpLimit') : 0;
$durationSetting = $ini->hasVariable('VersionManagement', 'DraftsDuration') ? $ini->variable('VersionManagement', 'DraftsDuration') : array('days' => 90);
$isDurationSet = false;
$duration = 0;
if (is_array($durationSetting)) {
if (isset($durationSetting['days']) and is_numeric($durationSetting['days'])) {
$duration += $durationSetting['days'] * 60 * 60 * 24;
$isDurationSet = true;
}
if (isset($durationSetting['hours']) and is_numeric($durationSetting['hours'])) {
$duration += $durationSetting['hours'] * 60 * 60;
$isDurationSet = true;
}
if (isset($durationSetting['minutes']) and is_numeric($durationSetting['minutes'])) {
$duration += $durationSetting['minutes'] * 60;
$isDurationSet = true;
}
if (isset($durationSetting['seconds']) and is_numeric($durationSetting['seconds'])) {
$duration += $durationSetting['seconds'];
$isDurationSet = true;
}
}
if ($isDurationSet) {
$expiryTime = time() - $duration;
$processedCount = eZContentObjectVersion::removeVersions(eZContentObjectVersion::STATUS_DRAFT, $draftsCleanUpLimit, $expiryTime);
$cli->output("Cleaned up " . $processedCount . " drafts");
} else {
$cli->output("Lifetime is not set for user's drafts (see your ini-settings, content.ini, VersionManagement section).");
}
示例3: removeVersions
/**
* @param int|bool $versionStatus
* @deprecated This method is left here only for backward compatibility. Use eZContentObjectVersion::removeVersions() method instead.
*/
static function removeVersions( $versionStatus = false )
{
eZContentObjectVersion::removeVersions( $versionStatus );
}
示例4:
if ($dbUser !== false) {
$params['user'] = $dbUser;
$params['password'] = '';
}
if ($dbPassword !== false) {
$params['password'] = $dbPassword;
}
if ($dbName !== false) {
$params['database'] = $dbName;
}
$db = eZDB::instance($dbImpl, $params, true);
eZDB::setInstance($db);
}
$db->setIsSQLOutputEnabled($showSQL);
if ($flatten['contentobject']) {
$cli->output("Removing non-published content object versions");
eZContentObjectVersion::removeVersions();
}
if ($flatten['contentclass']) {
$cli->output("Removing temporary content classes");
eZContentClass::removeTemporary();
}
if ($flatten['workflow']) {
$cli->output("Removing temporary workflows");
eZWorkflow::removeTemporary();
}
if ($flatten['role']) {
$cli->output("Removing temporary roles");
eZRole::removeTemporary();
}
$script->shutdown();