当前位置: 首页>>代码示例>>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;未经允许,请勿转载。