本文整理汇总了PHP中SqlUtility::revertQueryFromFile方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlUtility::revertQueryFromFile方法的具体用法?PHP SqlUtility::revertQueryFromFile怎么用?PHP SqlUtility::revertQueryFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlUtility
的用法示例。
在下文中一共展示了SqlUtility::revertQueryFromFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SqlUtility
/*******
* module_uninstall.php performs reversion of module_install.php
*/
/*******
* the line below safe-guards this file from being accessed directly from
* a web browser. It will only execute if required from within an ATutor script,
* in our case the Module::uninstall() method.
*/
if (!defined('AT_INCLUDE_PATH')) {
exit;
}
/********
* the following code is used for removing a module-specific directory created in module_install.php.
* it generates appropriate error messages to aid in its creation.
*/
//$directory = AT_CONTENT_DIR .'job_board';
/******
* the following code checks if there are any errors (generated previously)
* then uses the SqlUtility to run reverted database queries of module.sql,
* ie. "create table" statement in module.sql is run as drop according table.
*/
if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
// deal with the SQL file:
require AT_INCLUDE_PATH . 'classes/sqlutility.class.php';
$sqlUtility = new SqlUtility();
/*
* the SQL file could be stored anywhere, and named anything, "module.sql" is simply
* a convention we're using.
*/
$sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
}
示例2: dirname
<?php
if (!defined('AT_INCLUDE_PATH')) {
exit;
}
// directory
$directory = AT_CONTENT_DIR . 'adobe_connect';
if (is_dir($directory) && is_writable($directory)) {
require AT_INCLUDE_PATH . '../mods/_core/file_manager/filemanager.inc.php';
if (!clr_dir($directory)) {
$msg->addError(array('MODULE_UNINSTALL', ' ' . $directory . ' can\'t be removed'));
}
}
// db
$sqlfilepath = dirname(__FILE__) . '/module.sql';
if (!$msg->containsErrors() && file_exists($sqlfilepath)) {
require_once AT_INCLUDE_PATH . 'classes/sqlutility.class.php';
$sqlUtility = new SqlUtility();
$sqlUtility->revertQueryFromFile($sqlfilepath, TABLE_PREFIX);
}