コード例 #1
0
 /**
  * check all links for a given table
  * alter links to reflect changes to the tablename
  *
  * @param string $table_name
  * @param string $table_name_new
  * @return mixed     true on success or PEAR_ERROR
  */
 function updateTableLinkRelations($table_name, $table_name_new)
 {
     if ($this->use_links) {
         if (!empty($this->links_trans)) {
             $aLinks = Openads_Links::readLinksDotIni($this->links_trans, $table_name);
             if (isset($aLinks[$table_name])) {
                 $aLinks[$table_name_new] = $aLinks[$table_name];
                 unset($aLinks[$table_name]);
             }
             foreach ($aLinks as $table => $aKeys) {
                 foreach ($aKeys as $field => $aTarget) {
                     if ($aTarget['table'] == $table_name) {
                         $aLinks[$table][$field]['table'] = $table_name_new;
                     }
                 }
             }
             return Openads_Links::writeLinksDotIni($this->links_trans, $aLinks);
         }
     }
     return true;
 }