本文整理汇总了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'");
}
示例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");
}
}
}
}
示例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);
}
}
示例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();
}
}
}