本文整理汇总了PHP中OC::needUpgrade方法的典型用法代码示例。如果您正苦于以下问题:PHP OC::needUpgrade方法的具体用法?PHP OC::needUpgrade怎么用?PHP OC::needUpgrade使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC
的用法示例。
在下文中一共展示了OC::needUpgrade方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRegularTask
/**
* @deprecated 6.0.0
* creates a regular task
* @param string $klass class name
* @param string $method method name
* @return boolean|null
* @since 4.5.0
*/
public static function addRegularTask($klass, $method)
{
if (!\OC::needUpgrade()) {
self::registerJob('OC\\BackgroundJob\\Legacy\\RegularJob', array($klass, $method));
return true;
}
}
示例2: checkServer
/**
* @brief check if the current server configuration is suitable for ownCloud
* @return array arrays with error messages and hints
*/
public static function checkServer()
{
$errors = array();
$CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
if (!\OC::needUpgrade() && OC_Config::getValue('installed', false)) {
// this check needs to be done every time
$errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
}
// Assume that if checkServer() succeeded before in this session, then all is fine.
if (\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded')) {
return $errors;
}
$defaults = new \OC_Defaults();
$webServerRestart = false;
//check for database drivers
if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect') and !is_callable('oci_connect')) {
$errors[] = array('error' => 'No database drivers (sqlite, mysql, or postgresql) installed.', 'hint' => '');
$webServerRestart = true;
}
//common hint for all file permissions error messages
$permissionsHint = 'Permissions can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.';
// Check if config folder is writable.
if (!is_writable(OC::$SERVERROOT . "/config/") or !is_readable(OC::$SERVERROOT . "/config/")) {
$errors[] = array('error' => "Can't write into config directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.');
}
// Check if there is a writable install folder.
if (OC_Config::getValue('appstoreenabled', true)) {
if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
$errors[] = array('error' => "Can't write into apps directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the apps directory</a> ' . 'or disabling the appstore in the config file.');
}
}
// Create root dir.
if (!is_dir($CONFIG_DATADIRECTORY)) {
$success = @mkdir($CONFIG_DATADIRECTORY);
if ($success) {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
} else {
$errors[] = array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY . ")", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.');
}
} else {
if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
$errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
} else {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
}
}
if (!OC_Util::isSetLocaleWorking()) {
$errors[] = array('error' => 'Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed', 'hint' => 'Please install one of theses locales on your system and restart your webserver.');
}
$moduleHint = "Please ask your server administrator to install the module.";
// check if all required php modules are present
if (!class_exists('ZipArchive')) {
$errors[] = array('error' => 'PHP module zip not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!class_exists('DOMDocument')) {
$errors[] = array('error' => 'PHP module dom not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('xml_parser_create')) {
$errors[] = array('error' => 'PHP module libxml not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('mb_detect_encoding')) {
$errors[] = array('error' => 'PHP module mb multibyte not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('ctype_digit')) {
$errors[] = array('error' => 'PHP module ctype is not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('json_encode')) {
$errors[] = array('error' => 'PHP module JSON is not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!extension_loaded('gd') || !function_exists('gd_info')) {
$errors[] = array('error' => 'PHP module GD is not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('gzencode')) {
$errors[] = array('error' => 'PHP module zlib is not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('iconv')) {
$errors[] = array('error' => 'PHP module iconv is not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (!function_exists('simplexml_load_string')) {
$errors[] = array('error' => 'PHP module SimpleXML is not installed.', 'hint' => $moduleHint);
$webServerRestart = true;
}
if (version_compare(phpversion(), '5.3.3', '<')) {
$errors[] = array('error' => 'PHP 5.3.3 or higher is required.', 'hint' => 'Please ask your server administrator to update PHP to the latest version.' . ' Your PHP version is no longer supported by ownCloud and the PHP community.');
$webServerRestart = true;
}
if (!defined('PDO::ATTR_DRIVER_NAME')) {
//.........这里部分代码省略.........
示例3: addQueuedTask
/**
* @deprecated
* queues a task
* @param string $app app name
* @param string $class class name
* @param string $method method name
* @param string $parameters all useful data as text
* @return int id of task
*/
public static function addQueuedTask($app, $class, $method, $parameters)
{
if (!\OC::needUpgrade()) {
self::registerJob('OC\\BackgroundJob\\Legacy\\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters));
return true;
}
}