public function put($key, $value, $minutes) { $value = $this->packing($value); $time = $this->expiration($minutes); $name = $this->hash($key); //$name = $key; // $this->establish(); // if (!Schema::existe($this->DatabaseTableName(), Database::$serverData['database'])) { $this->createCacheTable(); } $data = [["name" => $name, "val" => $value, "life" => $time]]; if (!$this->exists($key)) { Schema::table($this->DatabaseTableName())->insert($data); } else { Schema::table($this->DatabaseTableName())->update("name='" . $name . "'", $data); } // $this->back(); }
public static function rollback($bundle) { $Root = Process::root; $r = glob($Root . "app/bundles/{$bundle}/schemas/*.php"); // $pieces = array(); $pieces1 = array(); $pieces2 = array(); $full_names = array(); // $time = ""; $name = ""; // $f = array(); foreach ($r as $key) { $pieces = explode("app/bundles/{$bundle}/schemas/", $key); $pieces1 = explode("_", $pieces[1]); $time = $pieces1[0]; $p = explode(".", $pieces1[1]); $name = $p[0]; $f[] = $pieces1[0]; $pieces2[] = $pieces[1]; // $full_names = $pieces1[0] . "_" . $name; } $mx = max($f); // $ind = 0; $i = 0; // foreach ($pieces2 as $value) { if (strpos($value, $mx) !== false) { $ind = $i; } $i++; } $link = $r[$ind]; // include_once $link; if (down()) { if (Schema::existe(Config::get('database.migration'))) { self::updateRow('rolledback', $name, $time); } $full_names = $time . "_" . $name; Migration::updateRegister($full_names, "rollback", $Root, $bundle); return true; } else { false; } }