public function delete() { if (!$this->exists()) { return false; } // Deleting the from from disk path is the most common place for // something to go wrong, so we do that first. $file = $this->getStorageLocation(); if (file_exists($file) && is_file($file)) { unlink($file); } // Delete all the references to this image. ArticleAttachment::OnAttachmentDelete($this->m_data['id']); // Delete the description Translation::deletePhrase($this->m_data['fk_description_id']); $tmpData = $this->m_data; // Delete the record in the database $success = parent::delete(); $logtext = getGS('File #$1 "$2" deleted.', $tmpData['id'], $tmpData['file_name']); Log::Message($logtext, null, 39); return $success; } // fn delete
public function delete() { if (!$this->exists()) { return false; } // Delete the description Translation::deletePhrase($this->m_data['fk_description_id']); // Delete the record in the database return parent::delete(); }
/** * Deletes the current article type field. */ public function delete() { global $g_ado_db; if (!$this->exists()) { return false; } $oldFieldName = $this->m_data['field_name']; $typeName = $this->m_data['type_name']; $typeType = $this->getType(); $orders = $this->getOrders(); $translation = new Translation(null, $this->getPhraseId()); $translation->deletePhrase(); $success = false; if ($this->getPrintName() != 'NULL') { $queryStr = "ALTER TABLE `X" . $this->m_data['type_name'] . "` DROP COLUMN `" . $this->getName() . "`"; $success = $g_ado_db->Execute($queryStr); } if ($success || $this->getPrintName() == 'NULL') { $myType = $this->getType(); if ($myType == self::TYPE_TOPIC) { $queryStr = "DELETE FROM TopicFields WHERE ArticleType = " . $g_ado_db->escape($this->m_data['type_name']) . " and FieldName = " . $g_ado_db->escape($this->m_data['field_name']); $g_ado_db->Execute($queryStr); $this->m_rootTopicId = null; } $fieldName = $this->m_data['field_name']; $success = parent::delete(); } if ($success) { if ($typeType == self::TYPE_COMPLEX_DATE) { $em = Zend_Registry::get('container')->getService('em'); $repo = $em->getRepository('Newscoop\\Entity\\ArticleDatetime'); $repo->deleteField($typeName, array('old' => $oldFieldName)); } } // reorder if ($success) { $newOrders = array(); foreach ($orders as $k => $v) { if (array_key_exists('field_name', $this->m_data)) { if ($v != $this->m_data['field_name']) { $newOrders[] = $v; } } } $newOrders = array_reverse($newOrders); $this->setOrders($newOrders); CampCache::singleton()->clear('user'); } return $success; }
/** * Deletes the current article type field. */ public function delete() { global $g_ado_db; if (!$this->exists()) { return false; } $orders = $this->getOrders(); $translation = new Translation(null, $this->getPhraseId()); $translation->deletePhrase(); if ($this->getPrintName() != 'NULL') { $queryStr = "ALTER TABLE `X" . $this->m_data['type_name'] . "` DROP COLUMN `" . $this->getName() . "`"; $success = $g_ado_db->Execute($queryStr); } if ($success || $this->getPrintName() == 'NULL') { $myType = $this->getType(); if ($myType == self::TYPE_TOPIC) { $queryStr = "DELETE FROM TopicFields WHERE ArticleType = '" . $g_ado_db->escape($this->m_data['type_name']) . "' and FieldName = '" . $g_ado_db->escape($this->m_data['field_name']) . "'"; $g_ado_db->Execute($queryStr); $this->m_rootTopicId = null; } $fieldName = $this->m_data['field_name']; $success = parent::delete(); } // reorder if ($success) { $newOrders = array(); foreach ($orders as $k => $v) { if ($v != $this->m_data['field_name']) $newOrders[] = $v; } $newOrders = array_reverse($newOrders); $this->setOrders($newOrders); if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logtext = getGS('Article type field "$1" deleted', $fieldName); Log::Message($logtext, null, 72); CampCache::singleton()->clear('user'); } return $success; } // fn delete
/** * Delete the article type. This will delete the entire table * in the database. Not recommended unless there is no article * data in the table. */ public function delete() { global $g_ado_db; $translation = new Translation(null, $this->m_metadata->getPhraseId()); $translation->deletePhrase(); foreach ($this->m_dbColumns as $field) { $field->delete(); } $this->m_metadata->delete(); $queryStr = "DROP TABLE `" . $this->m_dbTableName . "`"; $success = $g_ado_db->Execute($queryStr); CampCache::singleton()->clear('user'); }
/** * Delete the article type. This will delete the entire table * in the database. Not recommended unless there is no article * data in the table. */ public function delete() { global $g_ado_db; $translation = new Translation(null, $this->m_metadata->getPhraseId()); $translation->deletePhrase(); foreach ($this->m_dbColumns as $field) { $field->delete(); } $this->m_metadata->delete(); $queryStr = "DROP TABLE `" . $this->m_dbTableName . "`"; $success = $g_ado_db->Execute($queryStr); CampCache::singleton()->clear('user'); if ($success) { if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logtext = getGS('The article type "$1" has been deleted.', $this->m_name); Log::Message($logtext, null, 62); } } // fn delete