Ejemplo n.º 1
0
 function clearCache($table_list)
 {
     global $application;
     CProfiler::DBLayerStart();
     $application->enterCriticalSection('database');
     foreach ($table_list as $table_name) {
         $this->cache->write($table_name, uniqid('', true));
         //  time()                    ,
     }
     $application->leaveCriticalSection();
     CProfiler::DBLayerStop();
 }
Ejemplo n.º 2
0
 /**
  * Gets a data array as a result of the execution the SELECT query.
  *
  * @param object $QueryData - the object of the DB classes
  * @param int $result_type - returned data type of the SELECT query,
  * MYSQL_ASSOC is by default
  * @return array data array, as a result of the execution the SELECT query
  *
  */
 function getDB_Result($QueryData, $result_type = QUERY_RESULT_ASSOC)
 {
     CProfiler::DBLayerStart();
     // logging changes to category tree
     $_cat_tree_logging = false;
     $_cat_tree_changing = false;
     $_cat_table = $this->table_prefix . 'categories';
     $_cat_descr_table = $this->table_prefix . 'categories_descr';
     switch ($QueryData->getQueryType()) {
         case DBQUERY_TYPE_INSERT:
         case DBQUERY_TYPE_MULTIPLE_INSERT:
         case DBQUERY_TYPE_INSERT_SELECT:
             if ($QueryData->getInsertTable() == $_cat_table) {
                 $_cat_tree_logging = true;
                 $_cat_tree_changing = true;
             }
             if ($QueryData->getInsertTable() == $_cat_descr_table) {
                 $_cat_tree_changing = true;
             }
             break;
         case DBQUERY_TYPE_REPLACE:
         case DBQUERY_TYPE_MULTIPLE_REPLACE:
             if ($QueryData->getReplaceTable() == $_cat_table) {
                 $_cat_tree_logging = true;
                 $_cat_tree_changing = true;
             }
             if ($QueryData->getReplaceTable() == $_cat_descr_table) {
                 $_cat_tree_changing = true;
             }
             break;
         case DBQUERY_TYPE_UPDATE:
             if (in_array($_cat_table, $QueryData->UpdateTables)) {
                 $_cat_tree_logging = true;
                 $_cat_tree_changing = true;
             }
             if (in_array($_cat_descr_table, $QueryData->UpdateTables)) {
                 $_cat_tree_changing = true;
             }
             break;
         case DBQUERY_TYPE_DELETE:
             if ($QueryData->getDeleteTable() == $_cat_table) {
                 $_cat_tree_logging = true;
                 $_cat_tree_changing = true;
             }
             if ($QueryData->getDeleteTable() == $_cat_descr_table) {
                 $_cat_tree_changing = true;
             }
             break;
     }
     if ($_cat_tree_changing) {
         modApiFunc('Catalog', 'resetFullCategoryStructure');
     }
     if ($_cat_tree_logging) {
         if (modApiFunc('Settings', 'getParamValue', 'TIMELINE', 'LOG_CATEGORY_TREE_CHANGES') != 'YES') {
             $_cat_tree_logging = false;
         }
     }
     if ($_cat_tree_logging) {
         $_status_before = modApiFunc('Catalog', 'checkCatalogTree');
     }
     $this->PrepareSQL($QueryData);
     // Run SQL
     $this->DB_MultiLang_PreExec($QueryData);
     $this->DB_Exec();
     $this->DB_MultiLang_PostExec($QueryData);
     $this->DB_Result($result_type);
     $result = $this->ResultArray;
     // logging changes to category tree
     if ($_cat_tree_logging) {
         $_status_after = modApiFunc('Catalog', 'checkCatalogTree');
         modApiFunc('Timeline', 'addCatTreeLog', $_status_before, $_status_after, $this->QueryString);
     }
     CProfiler::DBLayerStop();
     return $result;
 }