public function getIsLocal()
 {
     if (!$this->isLocal) {
         $this->isLocal = ServerUtility::isLocal($this->environment);
     }
     return $this->isLocal;
 }
Esempio n. 2
0
 /**
  * Check the table information cache for the given table data
  *
  * @param string $database
  * @param string $table
  * @return string
  */
 public function tableInfo($database, $table)
 {
     // use the mysql registry for this request to look up information about the database/table on this host
     $tableInfo = MysqlTableInfo::getInfo($this->hosts['master'], $database, $table);
     $MemcacheConn = null;
     if ($tableInfo) {
         return $tableInfo;
     }
     $key = current($this->hosts['master']) . "|{$database}.{$table}";
     $isLocal = ServerUtility::isLocal();
     // Using file cache to make thie more portable need to expose caching layer in the future
     CacheManager::setup(array("path" => sys_get_temp_dir()));
     $InstanceCache = CacheManager::Files();
     // when running a local machine we want to allow schema updates to happen at anytime so no caching layer in place
     if ($isLocal) {
         $tableInfo = false;
     } else {
         $tableInfo = $InstanceCache->get($key);
     }
     if (!$tableInfo) {
         $tableInfo = $this->generateSchemaJson($database, $table);
         $InstanceCache->set($key, $tableInfo, $this->tableInfoCacheSec);
         MysqlTableInfo::setInfo($this->hosts['master'], $database, $table, $tableInfo);
     }
     return $tableInfo;
 }