• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP versionCompare函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中versionCompare函数的典型用法代码示例。如果您正苦于以下问题:PHP versionCompare函数的具体用法?PHP versionCompare怎么用?PHP versionCompare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了versionCompare函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testVersionCompare

 function testVersionCompare()
 {
     $this->assertTrue(versionCompare('1.1.0', '1.1', '>='));
     $this->assertTrue(versionCompare('1.1.5', '1.1', '>='));
     $this->assertTrue(versionCompare('1.2', '1.1', '>='));
     $this->assertTrue(versionCompare('1.0.0', '1.1', '<='));
     $this->assertTrue(versionCompare('1.0', '1.1.0', '<='));
     $this->assertTrue(versionCompare('1.0', '1.0.0', '=='));
     $this->assertTrue(versionCompare('1.0.*', '1.0.0', '=='));
     $this->assertTrue(versionCompare('1.1', '1', '=='));
     $this->assertTrue(versionCompare('1.3.*', '1.0.0', '>'));
     $this->assertTrue(versionCompare('0.9.*', '1.0.0', '<'));
     $this->assertFalse(versionCompare('1.1', '1', '>'));
     $this->assertFalse(versionCompare('1.1', '1', '<'));
     $a = versionCompare('1.1', '1', 'l');
     $this->assertTrue($a->is('VERSION_COMPARE_OPERATOR_DOESNT_EXISTS'));
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:17,代码来源:varia.functions.test.php


示例2: unlink

if (!isset($module_directory)) {
    if (file_exists($temp_file)) {
        unlink($temp_file);
    }
    // Remove temp file
    $admin->print_error($MESSAGE['GENERIC_INVALID']);
}
// Check if this module is already installed
// and compare versions if so
$new_module_version = $module_version;
$action = "install";
if (is_dir(WB_PATH . '/modules/' . $module_directory)) {
    if (file_exists(WB_PATH . '/modules/' . $module_directory . '/info.php')) {
        require WB_PATH . '/modules/' . $module_directory . '/info.php';
        // Version to be installed is older than currently installed version
        if (versionCompare($module_version, $new_module_version, '>=')) {
            if (file_exists($temp_file)) {
                unlink($temp_file);
            }
            // Remove temp file
            $admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
        }
        $action = "upgrade";
    }
}
// Set module directory
$module_dir = WB_PATH . '/modules/' . $module_directory;
// Make sure the module dir exists, and chmod if needed
make_dir($module_dir);
// Unzip module to the module dir
if (isset($_POST['overwrite'])) {
开发者ID:wyg3958,项目名称:WebsiteBaker_CommunityEdition,代码行数:31,代码来源:install.php


示例3: unlink

if (!isset($language_code)) {
    if (file_exists($temp_file)) {
        unlink($temp_file);
    }
    // Remove temp file
    // Restore to correct language
    require WB_PATH . '/languages/' . LANGUAGE . '.php';
    $admin->print_error($MESSAGE['GENERIC_INVALID_LANGUAGE_FILE']);
}
// Set destination for language file
$language_file = WB_PATH . '/languages/' . $language_code . '.php';
$action = "install";
// Move to new location
if (file_exists($language_file)) {
    require $language_file;
    if (versionCompare($language_version, $new_language_version, '>=')) {
        // Restore to correct language
        require WB_PATH . '/languages/' . LANGUAGE . '.php';
        $admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
    }
    $action = "upgrade";
    unlink($language_file);
}
rename($temp_file, $language_file);
// Chmod the file
change_mode($language_file, 'file');
// Load language info into DB
load_language($language_file);
// Restore to correct language
require WB_PATH . '/languages/' . LANGUAGE . '.php';
// Print success message
开发者ID:WBCE,项目名称:WebsiteBaker_CommunityEdition,代码行数:31,代码来源:install.php


示例4: isset

<?php

require 'version.php';
if (isset($argv)) {
    $jqm = isset($argv[1]) ? $argv[1] : '';
    $jq = isset($argv[2]) ? $argv[2] : '';
    $jqm_zip = "http://jquerymobile.com/resources/download/jquery.mobile-" . $jqm . ".zip";
    $jqm_dir = "jquery.mobile-" . $jqm;
    $jq_path = "http://code.jquery.com/jquery-" . $jq . ".min.js";
    chdir('jqm');
    rrmdir($jqm);
    //get most recent version of jqm
    $versions = preg_grep('/^([^.])/', scandir("."));
    $most_recent = '';
    foreach ($versions as $version) {
        if (versionCompare($version, $most_recent)) {
            $most_recent = $version;
        }
    }
    mkdir($jqm);
    chdir($jqm);
    //Get the jqm zip file
    echo "Downloading the jQuery Mobile ZIP file...\n";
    getFile($jqm_zip, $jqm_dir . ".zip");
    //Extract the files to a temporary directory
    $zip = new ZipArchive();
    if ($zip->open($jqm_dir . ".zip") === true) {
        $zip->extractTo($jqm_dir);
        $zip->close();
    } else {
        echo "Could not extract ZIP file :(";
开发者ID:simonyanzi,项目名称:themeroller.jquerymobile.com,代码行数:31,代码来源:add_version.php


示例5: isMaxVersionExceeded

 /**
  * Returns that the maximal version is exceeded. 
  *  To have a working plugin this should be false
  * @public
  * @return (bool)
  */
 function isMaxVersionExceeded()
 {
     return versionCompare(MORGOS_VERSION, $this->_maxMorgOSVersion, '>');
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:10,代码来源:pluginmanager.class.php


示例6: doCloneTemplate

 public function doCloneTemplate()
 {
     if (!$this->request->is_POST()) {
         $this->redirect($this->html->getSecureURL('setting/setting', '&active=appearance'));
     }
     $this->loadLanguage('developer_tools/developer_tools');
     $this->loadModel('tool/developer_tools');
     $data = $this->request->post;
     $data['extension_category'] = 'template';
     $data['extension_type'] = 'template';
     $data['version'] = '1.0.0';
     $data['cartversions'][0] = MASTER_VERSION . '.' . MINOR_VERSION;
     $data['install_php'] = 1;
     $data['install_sql'] = 1;
     $data['route'] = $data['extension_txt_id'];
     $data['hook_file'] = $data['extension_txt_id'] . '_hook.php';
     $data['extension_admin_language_files'] = array('english');
     if ($data['clone_to'] == 'extension') {
         //if need clone as extension we need to create tpls-list, that will be placed into main.php file of extension
         $data['views'] = $this->model_tool_developer_tools->getTemplateViewList($data['proto_template']);
         $result = $this->model_tool_developer_tools->generateExtension($data);
         $success_text = $this->language->get('developer_tools_text_success_generated_extension');
     } else {
         if ($data['clone_to'] == 'core_template') {
             $result = $this->model_tool_developer_tools->cloneCoreTemplate($data);
             $success_text = $this->language->get('developer_tools_text_success_cloned_template');
         }
     }
     if (!$result) {
         $error = new AError('');
         return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => implode('<br>', $this->model_tool_developer_tools->error), 'reset_value' => false));
     }
     $this->session->data['success'] = $success_text;
     if (file_exists(DIR_BACKUP . 'developer_tools_autosave_' . $data['extension_txt_id'])) {
         unlink(DIR_BACKUP . 'developer_tools_autosave_' . $data['extension_txt_id']);
     }
     if (versionCompare(VERSION, '1.2.4', '>=')) {
         $url = $this->html->getSecureURL('design/template');
     } else {
         $url = $this->html->getSecureURL('setting/setting', '&active=appearance&tmpl_id=' . $data['extension_txt_id']);
     }
     $this->load->library('json');
     $this->response->addJSONHeader();
     $this->response->setOutput(AJson::encode(array('result_text' => $success_text, 'redirect_url' => $url)));
 }
开发者ID:profwema,项目名称:developer_tools_extension,代码行数:45,代码来源:developer_tools.php


示例7: updateAuto

 static function updateAuto()
 {
     dbEntry_module::sync();
     foreach (qg::$modules as $name => $egal) {
         // qg::$modules depency order is better then self::all()
         $E = D()->module->Entry(D()->row("SELECT * FROM module WHERE name = " . D()->quote($name)));
         $limit = G()->SET['qg']['module']['beta']->v ? 3 : 2;
         if ($E->local_version && versionCompare($E->local_version, $E->server_version, $limit)) {
             $E->update();
         }
     }
 }
开发者ID:nuxodin,项目名称:shwups-cms-v4,代码行数:12,代码来源:module.class.php


示例8: _upgradeCore

 /**
  * @return bool
  */
 private function _upgradeCore()
 {
     $package_info =& $this->session->data['package_info'];
     if (versionCompare(VERSION, $package_info['package_version'], ">=")) {
         $this->session->data['error'] = str_replace('%VERSION%', VERSION, $this->language->get('error_core_version')) . $package_info['package_version'] . '!';
         unset($this->session->data['package_info']);
         $this->redirect($this->_get_begin_href());
     }
     $corefiles = $package_info['package_content']['core'];
     $pmanager = new APackageManager();
     /*
     		 * Commented by decision do not use it in community version.
     		 * Pasted alerts before upgrade process start.
     		 * Do not remove code yet.
     		 *
     		//backup files
     		$backup = new ABackup('abantecart_' . str_replace('.','',VERSION));
     		//interrupt if backup directory is inaccessable
     		if ($backup->error) {
     			$this->session->data['error'] = implode("\n", $backup->error);
     			return false;
     		}
     		foreach ($corefiles as $core_file) {
     			if (file_exists(DIR_ROOT . '/' . $core_file)) {
     				if (!$backup->backupFile(DIR_ROOT . '/' . $core_file, false)) {
     					return false;
     				}
     			}
     		}
     		// backup database
     		if ($backup->dumpDatabase()) {
     			$backup_dirname = $backup->getBackupName();
     			if ($backup_dirname) {
     				if (!$backup->dumpDatabase()) {
     					$this->session->data['error'] = implode("\n", $backup->error);
     					return false;
     				}
     				if (!$backup->archive(DIR_BACKUP . $backup_dirname . '.tar.gz', DIR_BACKUP, $backup_dirname)) {
     					$this->session->data['error'] = implode("\n", $backup->error);
     					return false;
     				}
     			} else {
     				$this->session->data['error'] = 'Error: Unknown directory name for backup.';
     				return false;
     			}
     
     			$install_upgrade_history = new ADataset('install_upgrade_history', 'admin');
     			$install_upgrade_history->addRows(
     					array(
     							'date_added' => date("Y-m-d H:i:s", time()),
     							'name' => 'Backup before core upgrade. Core version: ' . VERSION,
     							'version' => VERSION,
     							'backup_file' => $backup_dirname . '.tar.gz',
     							'backup_date' => date("Y-m-d H:i:s", time()),
     							'type' => 'backup',
     							'user' => $this->user->getUsername() ));
     		} else {
     			$this->session->data['error'] = implode("\n", $backup->error);
     			return false;
     		}*/
     //replace files
     $pmanager->replaceCoreFiles();
     //run sql and php upgrade procedure files
     $package_dirname = $package_info['tmp_dir'] . $package_info['package_dir'];
     if ($pmanager->error) {
         $this->session->data['error'] = $pmanager->error;
     }
     /**
      * @var DOMNode $config
      */
     $config = simplexml_load_string(file_get_contents($package_dirname . '/package.xml'));
     if (!$config) {
         $this->session->data['error'] = 'Error: package.xml from package content is not valid xml-file!';
         unset($this->session->data['package_info']);
         $this->redirect($this->_get_begin_href());
     }
     $pmanager->upgradeCore($config);
     $pmanager->updateCoreVersion((string) $config->version);
     if ($pmanager->error) {
         $this->session->data['error'] .= "\n" . $pmanager->error;
     }
     return true;
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:86,代码来源:package_installer.php


示例9: validateCoreVersion

 /**
  *  is extension support current core version
  * @param string $extension_txt_id
  * @param SimpleXmlElement $config
  * @return bool
  */
 public function validateCoreVersion($extension_txt_id, $config)
 {
     if (!isset($config->cartversions->item)) {
         $this->errors[] = 'Error: config file of extension does not contain any information about versions of AbanteCart where it can be run.';
         return false;
     }
     $cart_versions = array();
     foreach ($config->cartversions->item as $item) {
         $version = (string) $item;
         $cart_versions[] = $version;
     }
     // check is cart version presents on extension cart version list
     foreach ($cart_versions as $version) {
         $result = versionCompare(VERSION, $version, '>=');
         if ($result) {
             return true;
         }
     }
     // if not - seek cart earlier version then current cart version in the list
     foreach ($cart_versions as $version) {
         $result = versionCompare($version, VERSION, '<');
         if ($result) {
             $error_text = 'Extension <b>%s</b> written for earlier version of Abantecart (v.%s) lower that you have. ';
             $error_text .= 'Probably all will be OK.';
             $error_text = sprintf($error_text, $extension_txt_id, implode(', ', $cart_versions));
             $this->session->data['error'] = $error_text;
             $this->messages->saveWarning($extension_txt_id . ' extension warning', $error_text);
             return true;
         }
     }
     $error_text = '<b>%s</b> extension cannot be installed. AbanteCart version incompability. ';
     $error_text .= sizeof($cart_versions) > 1 ? 'Versions <b>%s</b> are required.' : 'Version <b>%s</b> is required.';
     $this->errors[] = sprintf($error_text, $extension_txt_id, implode(', ', $cart_versions));
     return false;
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:41,代码来源:extension_manager.php


示例10: sprintf

$checkinterval = sprintf('%d', getConfig("check_new_version"));
if (!isset($checkinterval)) {
    $checkinterval = 7;
}
if ($checkinterval) {
    $needscheck = Sql_Fetch_Row_Query(sprintf('select date_add(value,interval %d day) < now() as needscheck from %s where item = "updatelastcheck"', $checkinterval, $tables["config"]));
    if ($needscheck[0]) {
        ini_set("user_agent", NAME . " (PHPlist version " . VERSION . ")");
        ini_set("default_socket_timeout", 5);
        if ($fp = @fopen("http://www.phplist.com/files/LATESTVERSION", "r")) {
            $latestversion = @fgets($fp);
            $latestversion = preg_replace("/[^\\.\\d]/", "", $latestversion);
            @fclose($fp);
            $thisversion = VERSION;
            $thisversion = preg_replace("/[^\\.\\d]/", "", $thisversion);
            if (!empty($latestversion) && versionCompare($latestversion, $thisversion)) {
                print '<div align=center><font color=green size=2>';
                print $GLOBALS['I18N']->get('A new version of PHPlist is available!');
                print '</font><br/>';
                print '<br/>' . $GLOBALS['I18N']->get('The new version may have fixed security issues,<br/>so it is recommended to upgrade as soon as possible');
                print '<br/>' . $GLOBALS['I18N']->get('Your version') . ': <b>' . $thisversion . '</b>';
                print '<br/>' . $GLOBALS['I18N']->get('Latest version') . ': <b>' . $latestversion . '</b><br/>  ';
                print '<a href="http://www.phplist.com/files/changelog">' . $GLOBALS['I18N']->get('View what has changed') . '</a>&nbsp;&nbsp;';
                print '<a href="http://www.phplist.com/files/phplist-' . $latestversion . '.tgz">' . $GLOBALS['I18N']->get('Download') . '</a></div>';
            }
        }
        Sql_Query(sprintf('replace into %s (item,value,editable) values("updatelastcheck",now(),0)', $tables["config"]));
    }
}
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'firefox')) {
    print '<div align="right"><a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=131358&amp;t=81"><img border="0" alt="Get Firefox!" title="Get Firefox!" src="images/getff.gif"/></a></div>';
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:home.php


示例11: preCheckAddon

function preCheckAddon($temp_addon_file)
{
    /**
     * This funtion performs pretest upfront of the Add-On installation process.
     * The requirements can be specified via the array $PRECHECK which needs to
     * be defined in the optional Add-on file precheck.php.
     */
    global $database, $admin, $TEXT, $HEADING, $MESSAGE;
    // path to the temporary Add-on folder
    $temp_path = WB_PATH . '/temp/unzip';
    // check if file precheck.php exists for the Add-On uploaded via WB installation routine
    if (!file_exists($temp_path . '/precheck.php')) {
        return;
    }
    // unset any previous declared PRECHECK array
    unset($PRECHECK);
    // include Add-On precheck.php file
    include $temp_path . '/precheck.php';
    // check if there are any Add-On requirements to check for
    if (!(isset($PRECHECK) && count($PRECHECK) > 0)) {
        return;
    }
    // sort precheck array
    $PRECHECK = sortPreCheckArray($PRECHECK);
    $failed_checks = 0;
    $msg = array();
    // check if specified addon requirements are fullfilled
    foreach ($PRECHECK as $key => $value) {
        switch ($key) {
            case 'WB_VERSION':
                if (isset($value['VERSION'])) {
                    // obtain operator for string comparison if exist
                    $operator = isset($value['OPERATOR']) && trim($value['OPERATOR']) != '' ? $value['OPERATOR'] : '>=';
                    // compare versions and extract actual status
                    $status = versionCompare(WB_VERSION, $value['VERSION'], $operator);
                    $msg[] = array('check' => 'WB-' . $TEXT['VERSION'] . ': ', 'required' => htmlentities($operator) . $value['VERSION'], 'actual' => WB_VERSION, 'status' => $status);
                    // increase counter if required
                    if (!$status) {
                        $failed_checks++;
                    }
                }
                break;
            case 'WB_ADDONS':
                if (is_array($PRECHECK['WB_ADDONS'])) {
                    foreach ($PRECHECK['WB_ADDONS'] as $addon => $values) {
                        if (is_array($values)) {
                            // extract module version and operator
                            $version = isset($values['VERSION']) && trim($values['VERSION']) != '' ? $values['VERSION'] : '';
                            $operator = isset($values['OPERATOR']) && trim($values['OPERATOR']) != '' ? $values['OPERATOR'] : '>=';
                        } else {
                            // no version and operator specified (only check if addon exists)
                            $addon = strip_tags($values);
                            $version = '';
                            $operator = '';
                        }
                        // check if addon is listed in WB database
                        $table = TABLE_PREFIX . 'addons';
                        $sql = "SELECT * FROM `{$table}` WHERE `directory` = '" . addslashes($addon) . "'";
                        $results = $database->query($sql);
                        $status = false;
                        $addon_status = $TEXT['NOT_INSTALLED'];
                        if ($results && ($row = $results->fetchRow())) {
                            $status = true;
                            $addon_status = $TEXT['INSTALLED'];
                            // compare version if required
                            if ($version != '') {
                                $status = versionCompare($row['version'], $version, $operator);
                                $addon_status = $row['version'];
                            }
                        }
                        // provide addon status
                        $msg[] = array('check' => '&nbsp; ' . $TEXT['ADDON'] . ': ' . htmlentities($addon), 'required' => $version != '' ? $operator . '&nbsp;' . $version : $TEXT['INSTALLED'], 'actual' => $addon_status, 'status' => $status);
                        // increase counter if required
                        if (!$status) {
                            $failed_checks++;
                        }
                    }
                }
                break;
            case 'PHP_VERSION':
                if (isset($value['VERSION'])) {
                    // obtain operator for string comparison if exist
                    $operator = isset($value['OPERATOR']) && trim($value['OPERATOR']) != '' ? $value['OPERATOR'] : '>=';
                    // compare versions and extract actual status
                    $status = versionCompare(PHP_VERSION, $value['VERSION'], $operator);
                    $msg[] = array('check' => 'PHP-' . $TEXT['VERSION'] . ': ', 'required' => htmlentities($operator) . '&nbsp;' . $value['VERSION'], 'actual' => PHP_VERSION, 'status' => $status);
                    // increase counter if required
                    if (!$status) {
                        $failed_checks++;
                    }
                }
                break;
            case 'PHP_EXTENSIONS':
                if (is_array($PRECHECK['PHP_EXTENSIONS'])) {
                    foreach ($PRECHECK['PHP_EXTENSIONS'] as $extension) {
                        $status = extension_loaded(strtolower($extension));
                        $msg[] = array('check' => '&nbsp; ' . $TEXT['EXTENSION'] . ': ' . htmlentities($extension), 'required' => $TEXT['INSTALLED'], 'actual' => $status ? $TEXT['INSTALLED'] : $TEXT['NOT_INSTALLED'], 'status' => $status);
                        // increase counter if required
                        if (!$status) {
                            $failed_checks++;
//.........这里部分代码省略.........
开发者ID:WebsiteBaker-modules,项目名称:WB-Portable,代码行数:101,代码来源:addon.precheck.inc.php


示例12: initAllExtensions

 function initAllExtensions()
 {
     $this->extensions = array();
     $files = scandir('extensions');
     foreach ($files as $file) {
         $extension = array();
         $extensionDir = 'extensions/' . $file;
         if ($file[0] != '.') {
             if (is_dir($extensionDir)) {
                 if (file_exists($extensionDir . '/extension.php')) {
                     if (is_file($extensionDir . '/extension.php')) {
                         include $extensionDir . '/extension.php';
                         $minVersion = $extension['general']['minversion'];
                         $maxVersion = $extension['general']['maxversion'];
                         $extensionID = $extension['general']['ID'];
                         $isCompatibleFunction = $extension['iscompatible_function'];
                         if ($isCompatibleFunction != false) {
                             if (!$isCompatibleFunction($this->genDB)) {
                                 $compatible = false;
                             } else {
                                 $compatible = true;
                             }
                         } else {
                             $compatible = true;
                         }
                         if ($compatible) {
                             if ($extension['need_install'] == true) {
                                 $isInstalledFunction = $extension['is_installed_function'];
                                 $installable = $isInstalledFunction($this->genDB) ? false : true;
                                 $extension['is_installed'] = $isInstalledFunction($this->genDB);
                             } else {
                                 $installable = false;
                                 //$extension['is_isntalled']
                             }
                             $extension['installable'] = $installable;
                             if (versionCompare(MORGOS_VERSION, $minVersion, '<') || versionCompare(MORGOS_VERSION, $maxVersion, '>')) {
                                 $status = 'incompatible';
                             } elseif ($this->extensionIsLoaded($extensionID)) {
                                 $status = 'loaded';
                             } elseif ($installable == true) {
                                 $status = 'not_installed';
                             } else {
                                 $status = 'ok';
                                 if (array_key_exists('required_file', $extension)) {
                                     foreach ($extension['required_file'] as $reqFile) {
                                         if (!file_exists($extensionDir . '/' . $reqFile)) {
                                             $status = 'missing_file';
                                         }
                                     }
                                 }
                             }
                         } else {
                             $status = 'incompatible';
                         }
                         $extension['status'] = $status;
                         $extension['extension_dir'] = $extensionDir;
                         $ID = $extension['general']['ID'];
                         if (!array_key_exists($ID, $this->extensions)) {
                             $this->extensions[$ID] = $extension;
                         } else {
                             trigger_error('ERROR: ' . $this->i10nMan->translate('Extension hasn\'t an unique ID'));
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:68,代码来源:uimanager.class.php


示例13: _upgradeCore

 /**
  * @return bool
  */
 private function _upgradeCore()
 {
     $package_info =& $this->session->data['package_info'];
     if (versionCompare(VERSION, $package_info['package_version'], ">=")) {
         $this->session->data['error'] = str_replace('%VERSION%', VERSION, $this->language->get('error_core_version')) . $package_info['package_version'] . '!';
         unset($this->session->data['package_info']);
         $this->redirect($this->_get_begin_href());
     }
     $corefiles = $package_info['package_content']['core'];
     $pmanager = new APackageManager();
     //#1 backup files
     $backup = new ABackup('abantecart_' . VERSION);
     foreach ($corefiles as $core_file) {
         if (file_exists(DIR_ROOT . '/' . $core_file)) {
             if (!$backup->backupFile(DIR_ROOT . '/' . $core_file, false)) {
                 return false;
             }
         }
     }
     //#2 backup database
     if ($backup->dumpDatabase()) {
         $backup_dirname = $backup->getBackupName();
         if ($backup_dirname) {
             if (!$backup->dumpDatabase()) {
                 $this->session->data['error'] = $backup->error;
                 return false;
             }
             if (!$backup->archive(DIR_BACKUP . $backup_dirname . '.tar.gz', DIR_BACKUP, $backup_dirname)) {
                 return false;
             }
         } else {
             return false;
         }
         $install_upgrade_history = new ADataset('install_upgrade_history', 'admin');
         $install_upgrade_history->addRows(array('date_added' => date("Y-m-d H:i:s", time()), 'name' => 'Backup before core upgrade. Core version: ' . VERSION, 'version' => VERSION, 'backup_file' => $backup_dirname . '.tar.gz', 'backup_date' => date("Y-m-d H:i:s", time()), 'type' => 'backup', 'user' => $this->user->getUsername()));
     } else {
         $this->session->data['error'] = $backup->error;
         return false;
     }
     //#3 replace files
     $pmanager->replaceCoreFiles();
     //#4 run sql and php upgare procedure files
     $package_dirname = $package_info['tmp_dir'] . $package_info['package_dir'];
     /**
      * @var SimpleXmlElement $config
      */
     $config = simplexml_load_string(file_get_contents($package_dirname . '/package.xml'));
     if (!$config) {
         $this->session->data['error'] = 'Error: package.xml from package content is not valid xml-file!';
         unset($this->session->data['package_info']);
         $this->redirect($this->_get_begin_href());
     }
     $pmanager->upgradeCore($config);
     $pmanager->updateCoreVersion((string) $config->version);
     return true;
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:59,代码来源:package_installer.php


示例14: genericDatabase

			<h2><?php 
echo $i10nMan->translate('Required');
?>
</h2>
			<p><?php 
echo $i10nMan->translate('PHP Version 4.0.0 or higher');
?>
: 
			<?php 
if (versionCompare(PHP_VERSION, '4.0.0', '>=')) {
    echo '<span class="ok">' . $i10nMan->translate('Yes') . '</span>';
} else {
    echo '<span class="notok">' . $i10nMan->translate('No') . '</span>';
    $canrun = false;
}
if (versionCompare(PHP_VERSION, '4.1.0', '<') and versionCompare(PHP_VERSION, '4.0.0', '>=')) {
    echo ' <span class="warning"> ' . $i10nMan->translate('MorgOS is untested on PHP lower than PHP 4.1.0, if you encouter problems please report this. ') . '</span>';
}
?>
			</p>
			<p><?php 
echo $i10nMan->translate('Databases available');
?>
</p>
			<?php 
$DBMan = new genericDatabase($i10nMan);
$supported = $DBMan->getAllSupportedDatabases();
$db = false;
echo '<ul>';
foreach ($supported as $key => $support) {
    $db = true;
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:31,代码来源:check.php


示例15: unlink

/**
 *	Check if this template is already installed
 *	and in this case compare versions
 *
 */
$new_template_version = $template_version;
if (is_dir(LEPTON_PATH . '/templates/' . $template_directory)) {
    if (file_exists(LEPTON_PATH . '/templates/' . $template_directory . '/info.php')) {
        require_once LEPTON_PATH . '/templates/' . $template_directory . '/info.php';
        $temp_error = false;
        $temp_msg = "";
        /**
         *	Version to be installed is older than currently installed version
         *
         */
        if (versionCompare($template_version, $new_template_version, '>=')) {
            $temp_error = true;
            $temp_msg = $MESSAGE['GENERIC_ALREADY_INSTALLED'];
        }
        /**
         *	Additional tests for required vars.
         *
         */
        if (!isset($template_license) || !isset($template_author) || !isset($template_directory) || !isset($template_author) || !isset($template_version) || !isset($template_function)) {
            $temp_error = true;
            $temp_msg = $MESSAGE["TEMPLATES_MISSING_PARTS_NOTICE"];
        }
        if (true === $temp_error) {
            if (file_exists($temp_file)) {
                unlink($temp_file);
            }
开发者ID:pixelhulk,项目名称:LEPTON,代码行数:31,代码来源:install.php


示例16: D

			<?php 
    if (preg_match('/^cms\\.(backend|cont|layout)\\./', $M->name)) {
        echo D()->one("SELECT count(*) FROM page WHERE module = " . D()->quote($M->name));
    }
    ?>
		<td style="text-align:center">
			<input onclick="moduleSetAccess(this,'<?php 
    echo $M;
    ?>
');" <?php 
    echo $M->access ? 'checked' : '';
    ?>
 type=checkbox>
		<td>
			<?php 
    if ($M->server_time && versionCompare($M->local_version, $M->server_version, 3)) {
        ?>
				<?php 
        if ($M->checkRemoteFolder()) {
            ?>
					<a class=updateBtn onclick="return moduleUpdate(this,'<?php 
            echo $M;
            ?>
');" href="">
						<?php 
            echo $M->local_time ? 'update' : 'installieren';
            ?>
					</a>
				<?php 
        } else {
            echo 'not found!';
开发者ID:nuxodin,项目名称:shwups-cms-v4,代码行数:31,代码来源:list.php


示例17: testVersionCompare

function testVersionCompare()
{
    $result = versionCompare('0.0.1', '0.0.2', ">");
    $shouldReturn = false;
    testResult("A comparing error 1", $result !== $shouldReturn);
    $result = versionCompare('0.0.1', '0.0.2', "<");
    $shouldReturn = true;
    testResult("A comparing error 2", $result !== $shouldReturn);
    $result = versionCompare('0.0.1', '0.0.2', "==");
    $shouldReturn = false;
    testResult("A comparing error 3", $result !== $shouldReturn);
    $result = versionCompare('0.0.1', '0.0.2', ">=");
    $shouldReturn = false;
    testResult("A comparing error 4", $result !== $shouldReturn);
    $result = versionCompare('0.0.1', '0.0.2', "<=");
    $shouldReturn = true;
    testResult("A comparing error 5", $result !== $shouldReturn);
    $result = versionCompare('1.0.1', '1.1', "<");
    $shouldReturn = true;
    testResult("A comparing error 6", $result !== $shouldReturn);
    $result = versionCompare('0.0.1', '0.0.*', "==");
    $shouldReturn = true;
    testResult("A comparing error 7, probably in * comparision", $result !== $shouldReturn);
    $result = versionCompare('0.0.1', '0.0.1', "<=");
    $shouldReturn = true;
    testResult("A comparing error 8", $result !== $shouldReturn);
    $result = versionCompare('1.0.1', '0.1.2', ">");
    $shouldReturn = true;
    testResult("A comparing error 9", $result !== $shouldReturn);
    $result = versionCompare('1.2.*', '1', "==");
    $shouldReturn = true;
    testResult("A comparing error 10", $result !== $shouldReturn);
    $result = versionCompare('1.2.*', '1', ">");
    $shouldReturn = false;
    testResult("A comparing error 11", $result !== $shouldReturn);
    $result = versionCompare('1.1', '1.0', "!=");
    $shouldReturn = true;
    testResult("A comparing error 12", $result !== $shouldReturn);
}
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:39,代码来源:compatible.test.php


示例18: _getBlockInfo4Xml

 private function _getBlockInfo4Xml($block_id)
 {
     $block_id = (int) $block_id;
     $sql = "SELECT b.block_id as block_id,\n\t\t\t\t       b.block_txt_id as block_txt_id,\n\t\t\t\t            b.controller as controller,\n\t\t\t\t            bt.parent_block_id as parent_block_id,\n\t\t\t\t            bt.template as template,\n\t\t\t\t            pb.block_txt_id as parent_block_txt_id\n\t\t\t   FROM " . DB_PREFIX . "blocks as b\n\t\t\t   LEFT JOIN " . DB_PREFIX . "block_templates as bt ON (b.block_id = bt.block_id)\n\t\t\t   LEFT JOIN " . DB_PREFIX . "blocks as pb ON (pb.block_id = bt.parent_block_id)\n\t\t\t   WHERE b.block_id = " . $block_id;
     $result = $this->db->query($sql);
     $output = array();
     foreach ($result->rows as $row) {
         $output['block_txt_id'] = $row['block_txt_id'];
         if ($this->template_id_src != 'default' || versionCompare(VERSION, '1.2.4', '<')) {
             $output['controller'] = $row['controller'];
         }
         if (($this->template_id_src != 'default' || versionCompare(VERSION, '1.2.4', '<')) && $this->placeholder_block_id == $row['parent_block_id']) {
             $output['templates']['template'][] = array('parent_block' => $row['parent_block_txt_id'], 'template_name' => $row['template']);
             // if we found needed template - interrupting loop
             break;
         }
     }
     return $output;
 }
开发者ID:profwema,项目名称:developer_tools_extension,代码行数:19,代码来源:developer_tools_layout_xml.php


示例19: array

                                return true;
                            } else {
                                if ($ver1[3] < $ver2[3]) {
                                    return false;
                                } else {
                                    //tie
                                    if ($ver1[4] >= $ver2[4]) {
                                        return true;
                                    } else {
                                        if ($ver1[4] < $ver2[4]) {
                                            return false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
$ALL_JQUERY_VERSIONS = array("1.0.1" => "1.6.4", "1.1.2" => "1.7.2", "1.2.1" => "1.8.3", "1.3.2" => "1.9.1", "1.4.5" => "1.11.1");
$VERSION_LIST = array_keys($ALL_JQUERY_VERSIONS);
$VERSION_LIST = array_reverse($VERSION_LIST);
$JQM_VERSION = "";
foreach ($VERSION_LIST as $VERSION) {
    if (versionCompare($VERSION, $JQM_VERSION)) {
        $JQM_VERSION = $VERSION;
    }
}
开发者ID:simonyanzi,项目名称:themeroller.jquerymobile.com,代码行数:31,代码来源:version.php


示例20: ini_set

<h1>Comunidad PHPlist</h1>
<p><b>&Uacute;ltima versi&oacute;n</b><br/>
Cuando vaya a presentar una notificaci&oacute;n de errores
aseg&uacute;rese de que tiene la &uacute;ltima versi&oacute;n.<br/>
<?php 
ini_set("user_agent", NAME . " (PHPlist version " .  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP version_add函数代码示例发布时间:2022-05-23
下一篇:
PHP version函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap