當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UpgradeHistory::checkForExisting方法代碼示例

本文整理匯總了PHP中UpgradeHistory::checkForExisting方法的典型用法代碼示例。如果您正苦於以下問題:PHP UpgradeHistory::checkForExisting方法的具體用法?PHP UpgradeHistory::checkForExisting怎麽用?PHP UpgradeHistory::checkForExisting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UpgradeHistory的用法示例。


在下文中一共展示了UpgradeHistory::checkForExisting方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCheckForExistingSQL

 public function testCheckForExistingSQL()
 {
     $patchToCheck = new stdClass();
     $patchToCheck->name = 'abc';
     $patchToCheck->id = '';
     $GLOBALS['db']->query("INSERT INTO upgrade_history (id, name, md5sum, date_entered) VALUES\n('444','abc','444','2008-12-20 08:08:20') ");
     $GLOBALS['db']->query("INSERT INTO upgrade_history (id, name, md5sum, date_entered) VALUES\n('555','abc','555','2008-12-20 08:08:20')");
     $uh = new UpgradeHistory();
     $return = $uh->checkForExisting($patchToCheck);
     $this->assertContains($return->id, array('444', '555'));
     $patchToCheck->id = '555';
     $return = $uh->checkForExisting($patchToCheck);
     $this->assertEquals($return->id, '444');
     $GLOBALS['db']->query("delete from upgrade_history where id='444'");
     $GLOBALS['db']->query("delete from upgrade_history where id='555'");
 }
開發者ID:rgauss,項目名稱:sugarcrm_dev,代碼行數:16,代碼來源:UpgradeHistoryTest.php

示例2: run

 public function run()
 {
     require_once 'ModuleInstall/PackageManager/PackageManager.php';
     $pm = new PackageManager();
     $packages = $pm->getinstalledPackages(array('module'));
     foreach ($packages as $pack) {
         if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
             $uh = new UpgradeHistory();
             $uh->name = $pack['name'];
             $history = $uh->checkForExisting($uh);
             $this->filesToRemove[] = "custom/Extension/application/Ext/Include/{$history->id_name}.php";
             $history->delete();
             $this->fileToDelete($this->filesToRemove);
             $this->log("Useless files of {$pack['name']} v{$pack['version']} removed");
         }
     }
     foreach ($pm->getPackagesInStaging() as $pack) {
         if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
             $file = UploadStream::getFSPath(hashToFile($pack['file']));
             $this->fileToDelete($file);
             foreach (array('manifest', 'icon') as $meta) {
                 $this->fileToDelete(pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . "-{$meta}.php");
             }
         }
     }
 }
開發者ID:jglaine,項目名稱:sugar761-ent,代碼行數:26,代碼來源:8_RemoveWebUpgrader.php

示例3: performUninstall

 function performUninstall($name)
 {
     $uh = new UpgradeHistory();
     $uh->name = $name;
     $uh->id_name = $name;
     $found = $uh->checkForExisting($uh);
     if ($found != null) {
         global $sugar_config;
         global $mod_strings;
         global $current_language;
         $base_upgrade_dir = sugar_cached("/upgrades");
         $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
         if (!isset($GLOBALS['mi_remove_tables'])) {
             $GLOBALS['mi_remove_tables'] = true;
         }
         $unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
         unzip($found->filename, $unzip_dir);
         $mi = new ModuleInstaller();
         $mi->silent = true;
         $mi->uninstall("{$unzip_dir}");
         $found->delete();
         unlink(remove_file_extension($found->filename) . '-manifest.php');
         unlink($found->filename);
     }
 }
開發者ID:netconstructor,項目名稱:sugarcrm_dev,代碼行數:25,代碼來源:PackageManager.php

示例4: performUninstall

 function performUninstall($name)
 {
     $uh = new UpgradeHistory();
     $uh->name = $name;
     $uh->id_name = $name;
     $found = $uh->checkForExisting($uh);
     if ($found != null) {
         global $sugar_config;
         global $mod_strings;
         global $current_language;
         $base_upgrade_dir = $this->upload_dir . '/upgrades';
         $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
         if (is_file($found->filename)) {
             if (!isset($GLOBALS['mi_remove_tables'])) {
                 $GLOBALS['mi_remove_tables'] = true;
             }
             $unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
             unzip($found->filename, $unzip_dir);
             $mi = new ModuleInstaller();
             $mi->silent = true;
             $mi->uninstall("{$unzip_dir}");
             $found->delete();
             unlink(remove_file_extension($found->filename) . '-manifest.php');
             unlink($found->filename);
         } else {
             //file(s_ have been deleted or are not found in the directory, allow database delete to happen but no need to change filesystem
             $found->delete();
         }
     }
 }
開發者ID:omusico,項目名稱:sugar_work,代碼行數:30,代碼來源:PackageManager.php


注:本文中的UpgradeHistory::checkForExisting方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。