本文整理汇总了PHP中OC_DB::enableCaching方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_DB::enableCaching方法的具体用法?PHP OC_DB::enableCaching怎么用?PHP OC_DB::enableCaching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_DB
的用法示例。
在下文中一共展示了OC_DB::enableCaching方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
*/
public function upgrade()
{
\OC_DB::enableCaching(false);
\OC_Config::setValue('maintenance', true);
$installedVersion = \OC_Config::getValue('version', '0.0.0');
$currentVersion = implode('.', \OC_Util::getVersion());
if ($this->log) {
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
}
$this->emit('\\OC\\Updater', 'maintenanceStart');
try {
\OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
$this->emit('\\OC\\Updater', 'dbUpgrade');
// do a file cache upgrade for users with files
// this can take loooooooooooooooooooooooong
$this->upgradeFileCache();
} catch (\Exception $exception) {
$this->emit('\\OC\\Updater', 'failure', array($exception->getMessage()));
}
\OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
\OC_App::checkAppsRequirements();
// load all apps to also upgrade enabled apps
\OC_App::loadApps();
$repair = new Repair();
$repair->run();
\OC_Config::setValue('maintenance', false);
$this->emit('\\OC\\Updater', 'maintenanceEnd');
}
示例2: upgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
*/
public function upgrade()
{
\OC_DB::enableCaching(false);
\OC_Config::setValue('maintenance', true);
$installedVersion = \OC_Config::getValue('version', '0.0.0');
$currentVersion = implode('.', \OC_Util::getVersion());
if ($this->log) {
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
}
$this->emit('\\OC\\Updater', 'maintenanceStart');
// create empty file in data dir, so we can later find
// out that this is indeed an ownCloud data directory
// (in case it didn't exist before)
file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
/*
* START CONFIG CHANGES FOR OLDER VERSIONS
*/
if (!\OC::$CLI && version_compare($installedVersion, '6.00.4', '<')) {
// Add the trusted_domains config if it is not existant
// This is added to prevent host header poisoning
\OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
}
/*
* STOP CONFIG CHANGES FOR OLDER VERSIONS
*/
try {
\OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
$this->emit('\\OC\\Updater', 'dbUpgrade');
// do a file cache upgrade for users with files
// this can take loooooooooooooooooooooooong
$this->upgradeFileCache();
} catch (\Exception $exception) {
$this->emit('\\OC\\Updater', 'failure', array($exception->getMessage()));
}
\OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
\OC_App::checkAppsRequirements();
// load all apps to also upgrade enabled apps
\OC_App::loadApps();
$repair = new Repair();
$repair->run();
//Invalidate update feed
\OC_Appconfig::setValue('core', 'lastupdatedat', 0);
\OC_Config::setValue('maintenance', false);
$this->emit('\\OC\\Updater', 'maintenanceEnd');
}
示例3: upgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
* except the main .htaccess file
*
* @return bool true if the operation succeeded, false otherwise
*/
public function upgrade()
{
\OC_DB::enableCaching(false);
\OC_Config::setValue('maintenance', true);
$installedVersion = \OC_Config::getValue('version', '0.0.0');
$currentVersion = implode('.', \OC_Util::getVersion());
if ($this->log) {
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
}
$this->emit('\\OC\\Updater', 'maintenanceStart');
try {
$this->doUpgrade($currentVersion, $installedVersion);
} catch (\Exception $exception) {
$this->emit('\\OC\\Updater', 'failure', array($exception->getMessage()));
}
\OC_Config::setValue('maintenance', false);
$this->emit('\\OC\\Updater', 'maintenanceEnd');
}
示例4: set_time_limit
<?php
set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
\OC_DB::enableCaching(false);
// initialize the event source before we enter maintenance mode because CSRF protection can terminate the script
$updateEventSource = new OC_EventSource();
OC_Config::setValue('maintenance', true);
$installedVersion = OC_Config::getValue('version', '0.0.0');
$currentVersion = implode('.', OC_Util::getVersion());
OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::WARN);
$watcher = new UpdateWatcher($updateEventSource);
OC_Hook::connect('update', 'success', $watcher, 'success');
OC_Hook::connect('update', 'failure', $watcher, 'failure');
$watcher->success('Turned on maintenance mode');
try {
$result = OC_DB::updateDbFromStructure(OC::$SERVERROOT . '/db_structure.xml');
$watcher->success('Updated database');
// do a file cache upgrade for users with files
// this can take loooooooooooooooooooooooong
__doFileCacheUpgrade($watcher);
} catch (Exception $exception) {
$watcher->failure($exception->getMessage());
}
OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
OC_App::checkAppsRequirements();
// load all apps to also upgrade enabled apps
OC_App::loadApps();
OC_Config::setValue('maintenance', false);
示例5: upgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
* except the main .htaccess file
*
* @return bool true if the operation succeeded, false otherwise
*/
public function upgrade()
{
$logLevel = \OC_Config::getValue('loglevel', \OCP\Util::WARN);
$this->emit('\\OC\\Updater', 'setDebugLogLevel', array($logLevel, $this->logLevelNames[$logLevel]));
\OC_Config::setValue('loglevel', \OCP\Util::DEBUG);
\OC_DB::enableCaching(false);
\OC_Config::setValue('maintenance', true);
$installedVersion = \OC_Config::getValue('version', '0.0.0');
$currentVersion = implode('.', \OC_Util::getVersion());
if ($this->log) {
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
}
$this->emit('\\OC\\Updater', 'maintenanceStart');
$success = true;
try {
$this->doUpgrade($currentVersion, $installedVersion);
} catch (\Exception $exception) {
\OCP\Util::logException('update', $exception);
$this->emit('\\OC\\Updater', 'failure', array(get_class($exception) . ': ' . $exception->getMessage()));
$success = false;
}
\OC_Config::setValue('maintenance', false);
$this->emit('\\OC\\Updater', 'maintenanceEnd');
$this->emit('\\OC\\Updater', 'updateEnd', array($success));
$this->emit('\\OC\\Updater', 'resetLogLevel', array($logLevel, $this->logLevelNames[$logLevel]));
\OC_Config::setValue('loglevel', $logLevel);
return $success;
}