function update_database_folder($new_folder_name) { $this->_init_attributes(); if ($this->db_metadata) { $this->db_metadata->mergeData(array('folder' => $new_folder_name, 'name' => $this->getNameForFolder($new_folder_name))); $this->db_metadata->save(); } require_once 'Modules/Gallery/Image.inc.php'; require_once 'AMP/Content/Article.inc.php'; require_once 'AMP/Content/Section.inc.php'; require_once 'Modules/Gallery/Gallery.php'; require_once 'AMP/Content/Tag/Tag.php'; require_once 'AMP/Content/Template.inc.php'; require_once 'AMP/Content/Link/Link.php'; require_once 'AMP/User/Data/Data.php'; $this->update_associated_items('Section', 'image2', $new_folder_name); $this->update_associated_items('Section', 'flash', $new_folder_name); $this->update_associated_items('Article', 'image', $new_folder_name); $this->update_associated_items('Gallery', 'img', $new_folder_name); $this->update_associated_items('GalleryImage', 'img', $new_folder_name); $this->update_associated_items('AMP_Content_Tag', 'image', $new_folder_name); $this->update_associated_items('AMP_Content_Link', 'image', $new_folder_name); //article body search $finder = new Article(AMP_dbcon()); $update_action = "test=REPLACE( test, " . $finder->dbcon->qstr($this->getName()) . ", " . $finder->dbcon->qstr($this->getNameForFolder($new_folder_name)) . ")"; $finder->update_all($update_action, array('image_in_body' => $this->getName())); //template body $finder = new AMP_Content_Template(AMP_dbcon()); $update_action = "header2=REPLACE( header2, " . $finder->dbcon->qstr($this->getName()) . ", " . $finder->dbcon->qstr($this->getNameForFolder($new_folder_name)) . ")"; $finder->update_all($update_action, array('image_in_body' => $this->getName())); //udm data AMP_User_Data::replace_image_references($this->getName(), $this->getNameForFolder($new_folder_name)); return true; }