public function execute() { try { Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE qu_g_logs DROP INDEX `IDX_qu_g_logs_1`'); } catch (Exception $e) { } Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE qu_g_logs ADD INDEX `IDX_qu_g_logs_1` (`accountuserid` ASC, `created` ASC)'); }
public function insert() { $this->set('created', Gpf_DbEngine_Database::getDateString()); $this->set('downloads', 0); $this->set('referenced', 0); return parent::insert(); }
public static function expireOldRequest() { $sql = new Gpf_SqlBuilder_UpdateBuilder(); $sql->set->add(self::STATUS, self::STATUS_EXPIRED); $sql->from->add(self::getName()); $sql->where->add(self::STATUS, '=', self::STATUS_PENDING); $sql->where->add(self::CREATED, '<', Gpf_DbEngine_Database::getDateString(time() - self::VALID_SECONDS)); $sql->execute(); }
protected function initDate(Pap_Stats_Params $statsParams, $timeOffset) { $clientTime = $this->createCurrentTime() + $timeOffset; $lastStartDay = $this->getLastStartDay($clientTime); $this->dateFrom = Gpf_DbEngine_Database::getDateString( mktime(0,0,0,date("m",$clientTime), date("d",$clientTime) - $lastStartDay, date("Y",$clientTime)) - $timeOffset); $this->dateTo = Gpf_DbEngine_Database::getDateString( mktime(23,59,59,date("m",$clientTime), date("d",$clientTime) - $lastStartDay + 6, date("Y",$clientTime)) - $timeOffset); $statsParams->setDateRange($this->dateFrom, $this->dateTo); }
public function execute() { $q = new Gpf_SqlBuilder_SelectBuilder(); $q->select->add('fixedcost'); $q->from->add(Pap_Db_Table_Transactions::getName()); $q->limit->set(0,1); try { $q->getAllRows(); return; } catch(Exception $e) { } $db = Gpf_DbEngine_Database::getDatabase(); $db->execute("ALTER TABLE qu_pap_transactions ADD fixedcost FLOAT NOT NULL DEFAULT '0'"); }
public function saveLanguageMetadata(Gpf_Db_Language $lang) { $lang->setName($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_NAME)); $lang->setEnglishName($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_ENG_NAME)); $lang->setActive(true); $lang->setAuthor($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_AUTHOR)); $lang->setVersion($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_VERSION)); $lang->setImported(Gpf_DbEngine_Database::getDateString()); $lang->setDateFormat($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_DATE_FORMAT)); $lang->setTimeFormat($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_TIME_FORMAT)); $lang->setThousandsSeparator($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_THOUSANDS_SEPARATOR)); $lang->setDecimalSeparator($this->language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_DECIMAL_SEPARATOR)); $lang->setTranslatedPercentage($this->language->getTranslationPercentage()); $lang->setIsDefault(false); $lang->save(); }
public function execute() { try { Gpf_DbEngine_Database::getDatabase()->execute('SELECT `merchantnote` FROM `qu_pap_accountings`'); Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE `qu_pap_accountings` DROP `merchantnote`'); } catch (Gpf_DbEngine_Driver_Mysql_SqlException $e) { } try { Gpf_DbEngine_Database::getDatabase()->execute('SELECT `systemnote` FROM `qu_pap_accountings`'); Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE `qu_pap_accountings` DROP `systemnote`'); } catch (Gpf_DbEngine_Driver_Mysql_SqlException $e) { } try { Gpf_DbEngine_Database::getDatabase()->execute('SELECT `invoiceid` FROM `qu_pap_accountings`'); } catch (Gpf_DbEngine_Driver_Mysql_SqlException $e) { Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE `qu_pap_accountings` ADD `invoiceid` CHAR( 8 ) DEFAULT NULL AFTER `accountid`'); } }
/** * * @service click delete * @param ids, status * @return Gpf_Rpc_Action */ public function deleteClicks(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $date = array(); switch ($action->getParam("status")) { case self::DATE_ONE_WEEK: $filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L7D")); $date = $filter->addDateValueToArray($date); $olderThan = "one week"; break; case self::DATE_TWO_WEEKS: $dateFrom = Gpf_DbEngine_Database::getDateString( Gpf_Common_DateUtils::getServerTime( mktime(0,0,0,date("m"), date("d") - 14, date("Y")))); $date = array("dateFrom" => $dateFrom); $olderThan = "two weeks"; break; case self::DATE_ONE_MONTH: $filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L30D")); $date = $filter->addDateValueToArray($date); $olderThan = "one month"; break; } $action->setInfoMessage($this->_("Raw clicks older than %s are deleted", $olderThan)); $action->setErrorMessage($this->_("Failed to delete raw clicks")); $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_RawClicks::getName()); $delete->where->add(Pap_Db_Table_RawClicks::DATETIME, "<", $date["dateFrom"]); try { $delete->delete(); $action->addOk(); } catch(Gpf_DbEngine_NoRowException $e) { $action->addError(); } return $action; }
public function execute() { try { Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE `qu_pap_transactions` ADD INDEX `IDX_qu_pap_transactions_data1` ( `data1` )'); } catch (Exception $e) { } }
/** * @return Gpf_DbEngine_Database */ public static function create($hostname, $username, $password, $dbname) { self::$database = self::createDriver(self::MYSQL); self::$database->init($hostname, $username, $password, $dbname); return self::$database; }
public function disconnect() { @mysql_close($this->handle); $this->handle = null; parent::disconnect(); }
public function insert() { $this->set('created', Gpf_DbEngine_Database::getDateString()); parent::insert(); }
function insert() { $this->set(Gpf_Db_Table_PasswordRequests::CREATED, Gpf_DbEngine_Database::getDateString()); $this->setStatus(Gpf_Db_Table_PasswordRequests::STATUS_PENDING); parent::insert(); }
public static function setStorageEngine(Gpf_DbEngine_Database $db) { $sql = "SET storage_engine=MYISAM"; $db->execute($sql); }
//variables section echo '<h2>Server variables</h2>'; echo '<table border="0" cellpadding="3" width="600"> <tr class="h"><th>Variable</th><th>Value</th></tr>'; $result = Gpf_DbEngine_Database::getDatabase()->execute("show variables"); while ($row=$result->fetchArray()) { echo '<tr><td class="e">'.$row['Variable_name'].' </td><td class="v">'.$row['Value'].' </td></tr>'; } echo '</table><br/>'; //server status echo '<h2>Server status</h2>'; echo '<table border="0" cellpadding="3" width="600"> <tr class="h"><th>Variable</th><th>Value</th></tr>'; $result = Gpf_DbEngine_Database::getDatabase()->execute("SHOW STATUS"); while ($row=$result->fetchArray()) { echo '<tr><td class="e">'.$row['Variable_name'].' </td><td class="v">'.$row['Value'].' </td></tr>'; } echo '</table><br/>'; //process list - NOT used /*echo '<h2>Process list</h2>'; echo '<table border="0" cellpadding="3" width="600"> <tr class="h"><th>Id</th><th>User</th><th>Host</th><th>db</th><th>Command</th><th>Time</th><th>State</th><th>Info</th></tr>'; $result = Gpf_DbEngine_Database::getDatabase()->execute("SHOW PROCESSLIST"); while ($row=$result->fetchArray()) { echo '<tr><td class="e">'.$row['Id'].' </td><td class="v">'.$row['User'].' </td><td class="v">'.$row['Host'].' </td><td class="v">'.$row['db'].' </td><td class="v">'.$row['Command'].' </td><td class="v">'.$row['Time'].' </td><td class="v">'.$row['State'].' </td><td class="v">'.$row['Info'].' </td></tr>'; } echo '</table><br/>';*/
protected function getWeek($year, $month, $day, $dayFrom, $dayTo) { $w = date('w', mktime(0, 0, 0, $month, $day, $year)); $dateRange['from'] = Gpf_DbEngine_Database::getDateString($this->getServerTime(mktime(0, 0, 0, $month, $day - $w + $dayFrom, $year))); $dateRange['to'] = Gpf_DbEngine_Database::getDateString($this->getServerTime(mktime(23, 59, 59, $month, $day - $w + $dayTo, $year))); return $dateRange; }
protected function setTimeVariableValues($timeOffset = 0) { parent::setTimeVariableValues($timeOffset); $this->setVariable('validUntil', Gpf_DbEngine_Database::getDateString(time() + Gpf_Db_Table_PasswordRequests::VALID_SECONDS + $timeOffset)); }
public function execute() { try { Gpf_DbEngine_Database::getDatabase()->execute('ALTER TABLE `qu_pap_visits1` DROP INDEX `fk_qu_pap_visits1_qu_g_accounts1`'); } catch (Exception $e) { } }
public function insert() { $this->set('imported', Gpf_DbEngine_Database::getDateString()); $this->setId($this->generateId()); $this->checkIsDefaultStatus(); return parent::insert(); }
protected function createDatabase() { return Gpf_DbEngine_Database::getDatabase(); }
private function addSessionInfoToCache() { $sessionInfo = new Gpf_Rpc_Data(); $sessionInfo->setValue(Gpf_Rpc_Params::SESSION_ID, Gpf_Session::getInstance()->getId()); $sessionInfo->setValue('loggedUser', Gpf_Session::getAuthUser()->getFirstName() . ' ' . Gpf_Session::getAuthUser()->getLastName()); $sessionInfo->setValue('loggedUserEmail', Gpf_Session::getAuthUser()->getUsername()); $sessionInfo->setValue('serverTime', Gpf_DbEngine_Database::getDateString()); $sessionInfo->setValue('baseUrl', rtrim(Gpf_Paths::getInstance()->getBaseServerUrl(), '/')); $this->setSessionInfo($sessionInfo); Gpf_Rpc_CachedResponse::addById($sessionInfo, self::SESSION); }