本文整理汇总了PHP中db_table_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP db_table_exists函数的具体用法?PHP db_table_exists怎么用?PHP db_table_exists使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_table_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_pending_update_notice
/**
* Show the pending update notice on admin pages
*
*/
public static function show_pending_update_notice(&$vars)
{
if (ShareaholicUtilities::is_admin_page() && ShareaholicUtilities::has_accepted_terms_of_service() && !db_table_exists('shareaholic_content_settings') && user_access('administer modules')) {
$message = sprintf(t('Action required: You have pending updates required by Shareaholic. Please go to update.php for more information.'));
$vars['page'] = self::header_message_html($message) . $vars['page'];
}
}
示例2: delete
/**
* Implements hook_node_delete().
*
* Delete the content settings for a node
* @param Object $node the node that will be deleted
*/
public static function delete($node)
{
if (!db_table_exists('shareaholic_content_settings')) {
return;
}
db_delete('shareaholic_content_settings')->condition('nid', $node->nid)->execute();
}
示例3: shareaholic_form_node_form_alter
/**
* Implements hook_form_node_form_alter().
*
* When the node form is presented, add additional options
* for Shareaholic Apps
*
* @param Array $form - Nested array of form elements
* @param Array $form_state - keyed array containing form state
* @param $form_id - String representing the name of the form itself
*/
function shareaholic_form_node_form_alter(&$form, &$form_state, $form_id)
{
$node = $form['#node'];
$form['shareaholic_options'] = array('#type' => 'fieldset', '#access' => TRUE, '#title' => 'Shareaholic Options', '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', '#weight' => 100);
// I have to namespace it this way because Drupal can't add
// the shareholic_options name to it
// when you process the form on submit!!!
$form['shareaholic_options']['shareaholic_hide_share_buttons'] = array('#type' => 'checkbox', '#title' => 'Hide Share Buttons');
$form['shareaholic_options']['shareaholic_hide_recommendations'] = array('#type' => 'checkbox', '#title' => 'Hide Related Content');
$form['shareaholic_options']['shareaholic_exclude_from_recommendations'] = array('#type' => 'checkbox', '#title' => 'Exclude from Related Content');
$form['shareaholic_options']['shareaholic_exclude_og_tags'] = array('#type' => 'checkbox', '#title' => 'Do not include Open Graph tags');
if (!db_table_exists('shareaholic_content_settings')) {
$form['shareaholic_options']['shareaholic_message'] = array('#type' => 'markup', '#markup' => '<p style="color:#FF0000;">' . t('Action required: you have some pending updates required by Shareaholic. Please go to update.php for more information.') . '</p>');
}
if ($node->shareaholic_options['shareaholic_exclude_from_recommendations']) {
$form['shareaholic_options']['shareaholic_exclude_from_recommendations']['#attributes'] = array('checked' => 'checked');
}
if ($node->shareaholic_options['shareaholic_hide_recommendations']) {
$form['shareaholic_options']['shareaholic_hide_recommendations']['#attributes'] = array('checked' => 'checked');
}
if ($node->shareaholic_options['shareaholic_hide_share_buttons']) {
$form['shareaholic_options']['shareaholic_hide_share_buttons']['#attributes'] = array('checked' => 'checked');
}
if ($node->shareaholic_options['shareaholic_exclude_og_tags']) {
$form['shareaholic_options']['shareaholic_exclude_og_tags']['#attributes'] = array('checked' => 'checked');
}
}
示例4: truncateTables
/**
* Truncates database tables.
*
* @param array $tables
* The list of tables to be truncated.
*/
public function truncateTables(array $tables = array())
{
foreach ($tables as $table) {
if (db_table_exists($table)) {
db_delete($table)->execute();
}
}
}
示例5: ensureAppTable
/**
* Ensure that the table for an app exists.
* @param $nid
* The app nid.
*/
private function ensureAppTable($nid)
{
if (!db_table_exists('app_' . $nid)) {
db_create_table('app_' . $nid, $this->getAppTableSchema($nid));
} else {
$this->pruneAppTable($nid);
}
}
示例6: translationwizard_uninstall
function translationwizard_uninstall()
{
output_notl("Performing Uninstall on Translation Wizard. Thank you for using!`n`n");
if (db_table_exists(db_prefix("temp_translations"))) {
db_query("DROP TABLE " . db_prefix("temp_translations"));
}
return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:8,代码来源:translationwizard.php
示例7: file_check_tables
function file_check_tables()
{
if (config_get('check-database')) {
if (!db_table_exists('files')) {
db_create_table_safe('files', array('id' => 'INT NOT NULL ' . 'PRIMARY KEY AUTO_INCREMENT', 'name' => 'TEXT', 'orig_name' => 'TEXT', 'access' => 'INT', 'blocked' => 'BOOL'));
}
}
}
示例8: wiki_initialize
function wiki_initialize()
{
if (config_get('check-database')) {
if (!db_table_exists('content')) {
db_create_table_safe('content', array('id' => 'INT NOT NULL PRIMARY ' . 'KEY AUTO_INCREMENT', 'order' => 'INT', 'pid' => 'INT DEFAULT 1', 'class' => 'TEXT', 'name' => 'TEXT', 'path' => 'TEXT', 'settings' => 'TEXT DEFAULT ""'));
db_insert('content', array('order' => '1', 'pid' => '0', 'name' => '"Корневой раздел"', 'path' => '"/"', 'settings' => '"' . addslashes('a:1:{s:8:"security";a:1:' . '{s:3:"ALL";a:2:{s:5:"order";s:10:"allow_deny";s:4:"acts";' . 'a:1:{i:0;a:2:{s:3:"act";s:8:"AllowAll";s:3:"val";' . 's:0:"";}}}}}') . '"'));
}
}
}
示例9: CheckTables
function CheckTables()
{
if (!config_get('check-database')) {
return;
}
if (!db_table_exists('market_basket')) {
db_create_table_safe('market_basket', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'user_id' => 'INT', 'session_id' => 'TEXT DEFAULT ""', 'item_id' => 'INT', 'timestamp' => 'INT'));
}
}
示例10: query
function query($iteratorClass = 'GoogleMiniResultIterator') {
if (!db_table_exists('cache_google_appliance')) {
$this->cache = FALSE;
}
if (!$this->cache) {
return parent::query($iteratorClass);
}
else {
$cached_result_obj = NULL;
$cache_key = md5($this->buildQuery());
$_cached_result_xml = cache_get($cache_key, 'cache_google_appliance');
$cached_result_xml = $_cached_result_xml->data;
$google_debug = variable_get('google_appliance_debug', 0);
if ($cached_result_xml) {
try {
$google_results = GoogleMini::resultFactory($cached_result_xml, $iteratorClass);
}
catch (Exception $e) {
drupal_set_message($e->getMessage(), 'error');
watchdog('google_appliance', $e->getMessage());
return FALSE;
}
if ($google_debug >= 2 ){
if (function_exists('dpr')) {
dpr("got cache for $cache_key");
}
}
elseif ($google_debug == 1) {
watchdog('google_appliance', "got cache for !cache_key at !url", array('!cache_key' => $cache_key, '!url' => $_GET['q']));
}
}
else {
try {
$google_results = parent::query($iteratorClass);
}
catch (Exception $e) {
drupal_set_message($e->getMessage(), 'error');
watchdog('google_appliance', $e->getMessage());
return FALSE;
}
$timeout = variable_get('google_appliance_cache_timeout', 600); // 10 minutes by default
cache_set($cache_key, $google_results->payload->asXML(), 'cache_google_appliance', time() + $timeout);
$google_debug = variable_get('google_debug', 0);
if ($google_debug >= 2 ){
if (function_exists('dpr')) {
dpr("setting cache for $cache_key");
}
}
elseif ($google_debug == 1) {
watchdog('google_appliance', "setting cache for !cache_key at !url", array('!cache_key' => $cache_key, '!url' => $_GET['q']));
}
}
return $google_results;
}
}
示例11: assertModuleTablesDoNotExist
/**
* Assert that none of the tables defined in a module's hook_schema() exist.
*
* @param $module
* The name of the module.
*/
function assertModuleTablesDoNotExist($module)
{
$tables = array_keys(drupal_get_module_schema($module));
$tables_exist = FALSE;
foreach ($tables as $table) {
if (db_table_exists($table)) {
$tables_exist = TRUE;
}
}
return $this->assertFalse($tables_exist, format_string('None of the database tables defined by the @module module exist.', array('@module' => $module)));
}
示例12: riddles_install
function riddles_install()
{
if (db_table_exists(db_prefix("riddles"))) {
debug("Riddles table already exists");
} else {
debug("Creating riddles table.");
// This is pulled out to another file just because it's so big.
// no reason to parse it every time this module runs.
require_once "modules/riddles/riddles_install.php";
}
module_addhook("superuser");
module_addeventhook("forest", "return 100;");
return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:14,代码来源:riddles.php
示例13: create_table
function create_table()
{
if (db_table_exists('shortcut_dataset') === True) {
if (DEBUG) {
echo "table already exists<br>\n";
}
return;
} else {
if (DEBUG) {
echo "create new table<br>\n";
}
db_query("create table shortcut_dataset(id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, val TEXT NOT NULL)");
}
}
示例14: testInvalidMigration
/**
* Tests that updates from schema versions prior to 8000 are prevented.
*/
function testInvalidMigration()
{
// Mock a D7 system table so that the schema value of the system module
// can be retrieved.
db_create_table('system', $this->getSystemSchema());
// Assert that the table exists.
$this->assertTrue(db_table_exists('system'), 'The table exists.');
// Insert a value for the system module.
db_insert('system')->fields(array('name' => 'system', 'schema_version' => 7000))->execute();
$system_schema = db_query('SELECT schema_version FROM {system} WHERE name = :system', array(':system' => 'system'))->fetchField();
$this->drupalGet($this->update_url, array('external' => TRUE));
$text = 'Your system schema version is ' . $system_schema . '. Updating directly from a schema version prior to 8000 is not supported. You must <a href="https://drupal.org/node/2179269">migrate your site to Drupal 8</a> first.';
$this->assertRaw($text, 'Updates from schema versions prior to 8000 are prevented.');
}
示例15: is_applied
function is_applied()
{
$t_upgrade_table = config_get_global('mantis_upgrade_table');
if (!db_table_exists($t_upgrade_table)) {
return false;
}
$query = "SELECT COUNT(*)\n\t\t\t\t\t FROM {$t_upgrade_table}\n\t\t\t\t\t WHERE upgrade_id = '{$this->id}'";
$result = db_query($query);
if (0 < db_result($result)) {
return true;
} else {
return false;
}
}