예제 #1
0
파일: trash.php 프로젝트: rigidus/ea
 function dump()
 {
     $tables = implode(', ', self::$tables);
     $conf = implode(', ', self::$conf);
     db::table('admin_log_trash');
     db::order('log_id', 'DESC');
     db::limit(31, 100);
     $res = db::select('log_id');
     if (db::rows() > 0) {
         while ($row = mysql_fetch_assoc($res)) {
             self::delete($row['log_id']);
         }
     }
     if (self::$files) {
         $log_tmpl = 1;
     } else {
         $log_tmpl = 0;
     }
     db::table('admin_log_trash');
     db::insert('', 'NOW()', '', $tables, $conf, '', $log_tmpl, ADMIN_USER_ID);
     $log_id = mysql_insert_id();
     dump::tables(self::$tables);
     dump::backup(SYS_ROOT . 'var/trash/' . $log_id . '_base.zip');
     if (self::$conf) {
         foreach (self::$conf as $v) {
             zipfile::add(SYS_ROOT . 'conf/web/' . $v . '.ini');
         }
         zipfile::create(SYS_ROOT . 'var/trash/' . $log_id . '_conf.zip');
     }
     if (self::$files) {
         foreach (self::$files as $v) {
             zipfile::add($v);
         }
         zipfile::create(SYS_ROOT . 'var/trash/' . $log_id . '_files.zip');
     }
 }