Exemplo n.º 1
0
 public static function schemadb_update()
 {
     ## get class name
     $c = static::klass();
     ## avoid re-update by check the cache
     if (isset(static::$kache[$c]['updated'])) {
         return;
     }
     ## get table and model schema
     $t = static::table();
     $s = static::skema();
     ## have a valid schema update db table
     if (count($s) > 0) {
         schemadb::update_table($t, $s);
     }
     ## cache last update avoid multiple call
     static::$kache[$c]['updated'] = time();
     ## debug output
     if (SCHEMADB_DEBUG) {
         echo '<pre style="border:1px solid #9F6000;margin:0 0 1px 0;padding:2px;color:#9F6000;background:#FEEFB3;">';
         echo '<strong>' . str_pad('update', 10, ' ', STR_PAD_LEFT) . '</strong>: ' . $c . '</pre>';
     }
 }