예제 #1
0
 /**
  * Create or update the plugin's DB tables.
  *
  * @return bool
  */
 function make_schema_current()
 {
     global $blclog;
     if (!function_exists('blc_get_db_schema')) {
         require 'db-schema.php';
     }
     list($dummy, $query_log) = blcTableDelta::delta(blc_get_db_schema());
     $have_errors = false;
     foreach ($query_log as $item) {
         if ($item['success']) {
             $blclog->info(' [OK] ' . $item['query']);
         } else {
             $blclog->error(' [  ] ' . $item['query']);
             $blclog->error(' Database error : ' . $item['error_message']);
             $have_errors = true;
         }
     }
     $blclog->info('Database schema updated.');
     return !$have_errors;
 }
예제 #2
0
 /**
  * Create or update the plugin's DB tables.
  *
  * @return bool
  */
 static function make_schema_current()
 {
     global $blclog;
     $start = microtime(true);
     if (!function_exists('blc_get_db_schema')) {
         require 'db-schema.php';
     }
     list($dummy, $query_log) = blcTableDelta::delta(blc_get_db_schema());
     $have_errors = false;
     foreach ($query_log as $item) {
         if ($item['success']) {
             $blclog->info(' [OK] ' . $item['query'] . sprintf(' (%.3f seconds)', $item['query_time']));
         } else {
             $blclog->error(' [  ] ' . $item['query']);
             $blclog->error(' Database error : ' . $item['error_message']);
             $have_errors = true;
         }
     }
     $blclog->info(sprintf('Schema update took %.3f seconds', microtime(true) - $start));
     $blclog->info('Database schema updated.');
     return !$have_errors;
 }