function remove($id = null) { if (is_null($id)) { $this->e404(); } if ($this->Repository->delete($id)) { $this->Session->setFlash('Repository deleted successfuly'); CakeLog::write('activity', 'Repository [id=' . $id . '] deleted'); } else { $this->Session->setFlash('An error ocurred deleting the repository', 'flash_errors'); } if (Configure::read('App.subdomains')) { $dom = Configure::read('App.domain'); $this->redirect("http://www.{$dom}/admin_repositories"); } else { $this->redirect('index'); } }
public function testDeletingDocuments() { $config = new Config('/tmp/flywheel'); $repo = new Repository('_pages', $config); $id = 'delete_test'; $name = $id . '_' . sha1($id) . '.json'; $path = '/tmp/flywheel/_pages/' . $name; file_put_contents($path, ''); $this->assertTrue(is_file($path)); $repo->delete($id); $this->assertFalse(is_file($path)); }
/** * @inherit */ public function delete($id) { $result = parent::delete($id); if ($id instanceof DocumentInterface) { $id = $id->getId(); } if (!$result || !$this->deleteEmptyDirs || !$this->isNestedId($id)) { return $result; } $path = $this->getPathForDocument($id); $dir = dirname($path); if (file_exists($dir) && count(glob($dir . '/*')) === 0) { rmdir($dir); } return $result; }
/** * Delete repository * * @param null * @return void * */ function delete() { if (!$this->active_repository->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $delete = $this->active_repository->delete(true); CommitProjectObjects::delete("repository_id = '" . $this->active_repository->getId() . "'"); SourceUsers::delete("repository_id = '" . $this->active_repository->getId() . "'"); if ($delete && !is_error($delete)) { flash_success('Repository has been successfully deleted'); $this->redirectToUrl(source_module_url($this->active_project)); } else { $this->smarty->assign('errors', $delete); } // if }
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'av_init.php'; Session::logcheck("configuration-menu", "Osvdb"); $user = $_SESSION["_user"]; $error = false; $id_document = GET('id_document'); ossim_valid($id_document, OSS_DIGIT, 'illegal:' . _("Id_document")); if (ossim_error()) { $error_txt = ossim_get_error(); $error = true; } else { $db = new ossim_db(); $conn = $db->connect(); Repository::delete($conn, $id_document); $db->close(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> <?php echo gettext("OSSIM Framework"); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <meta http-equiv="Pragma" CONTENT="no-cache"/> <link rel="stylesheet" type="text/css" href="../style/av_common.css?t=<?php echo Util::get_css_id();
/** * * @param array $ids * @param object $currentUser */ public static function delete($ids, $currentUser = '') { if (isset($currentUser) && $currentUser instanceof User && in_array($currentUser->getId(), $ids)) { throw new Exception('You can\'t delete yourself', 4404); } if (!self::isLastAdmin($ids)) { foreach ($ids as $id) { $contact = User::getParameters($id, array('contact_id')); if (isset($contact['contact_id'])) { Contact::delete($contact['contact_id']); } } parent::delete($ids); } else { throw new Exception('You can\'t delete the last admin', 4404); } }
<?php namespace phorkie; /** * Delete paste or ask for deletion */ $reqWritePermissions = true; require_once 'www-header.php'; $repo = new Repository(); $repo->loadFromRequest(); if (isset($_GET['confirm']) && $_GET['confirm'] == 1) { if ($_SERVER['REQUEST_METHOD'] !== 'POST') { throw new Exception_Input('Deleting only possible via POST'); } $repo->delete(); redirect(Tools::fullUrl()); } render('delete', array('repo' => $repo));
public function testDelete() { $this->optionResourceMock->expects($this->once())->method('delete')->with($this->optionMock); $this->assertTrue($this->optionRepository->delete($this->optionMock)); }
<?php require_once 'classes/api/Transaction.php'; require_once 'classes/api/Connection.php'; require_once 'classes/api/Expression.php'; require_once 'classes/api/Criteria.php'; require_once 'classes/api/Repository.php'; require_once 'classes/api/Record.php'; require_once 'classes/api/Filter.php'; require_once 'classes/api/Logger.php'; require_once 'classes/api/LoggerTXT.php'; require_once 'classes/model/Produto.php'; try { Transaction::open('estoque'); Transaction::setLogger(new LoggerTXT('tmp/log_collection_delete.txt')); $criteria = new Criteria(); $criteria->add(new Filter('descricao', 'like', '%WEBC%'), Expression::OR_OPERATOR); $criteria->add(new Filter('descricao', 'like', '%FILMAD%'), Expression::OR_OPERATOR); $repository = new Repository('Produto'); $repository->delete($criteria); Transaction::close(); } catch (Exception $e) { echo $e->getMessage(); Transaction::rollback(); }
public function testDelete() { $attributeMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Eav\\Attribute', [], [], '', false); $this->attributeResourceMock->expects($this->once())->method('delete')->with($attributeMock); $this->assertEquals(true, $this->model->delete($attributeMock)); }