/** * Tests Capacity::cleanup */ public function testCleanupDeleteTarget() { $fileList = $this->getFileMockList(array(array('size' => 100, 'shouldBeDeleted' => true), array('size' => 100, 'shouldBeDeleted' => true), array('size' => 100, 'shouldBeDeleted' => true), array('size' => 100, 'shouldBeDeleted' => true), array('size' => 100, 'shouldBeDeleted' => true))); $resultStub = $this->getMockBuilder('\\phpbu\\App\\Result')->getMock(); $collectorStub = $this->getMockBuilder('\\phpbu\\App\\Backup\\Collector')->disableOriginalConstructor()->getMock(); $targetStub = $this->getMockBuilder('\\phpbu\\App\\Backup\\Target')->disableOriginalConstructor()->getMock(); $collectorStub->method('getBackupFiles')->willReturn($fileList); $targetStub->method('getSize')->willReturn(100); $targetStub->expects($this->once())->method('unlink'); $cleaner = new Capacity(); $cleaner->setup(array('size' => '0B', 'deleteTarget' => 'true')); $cleaner->cleanup($targetStub, $collectorStub, $resultStub); }
<ul style="list-style: none; margin: 0; padding: 0; width: 195px;"> <?php $newurl = $url . $toaddurl['brand'] . $toaddurl['capacity']; foreach (Color::getColorList() as $color) { $unactive = $sort['color'] != $color->id ? ' class="unactive"' : ''; echo '<li style="float: left; margin: 0 0 10px 10px;"><a href="' . $newurl . '&color=' . strtolower($color->id) . '" ' . $unactive . 'style="background: ' . $color->hex . '; border: 1px solid #ededed; display: inline-block; width: 30px; height: 30px; border-radius: 30px;" title="' . $color->name . '"></a></li>'; } ?> </ul> </div> <div style="display: block; width: 100%; overflow: hidden;"> <h4>Capacité</h4> <div class="list-group"> <?php $newurl = $url . $toaddurl['brand'] . $toaddurl['color']; foreach (Capacity::getCapacityList() as $capacity) { $active = $sort['capacity'] == $capacity->storage ? ' active' : ''; echo '<a href="' . $newurl . '&capacity=' . $capacity->storage . '" class="list-group-item' . $active . '">' . $capacity->storage . ' Go</a>'; } ?> </div> </div> </div> <?php if (!isset($_GET['p']) || $_GET['p'] < $totalPages + 1) { ?> <div class="col-md-9"> <div class="row"> <?php foreach ($phoneRequest as $phone) {
<?php define('PUBLIC_ROOT', dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))); define('ROOT', dirname(PUBLIC_ROOT)); define('DS', DIRECTORY_SEPARATOR); define('BASE_URL', dirname(dirname($_SERVER['SCRIPT_NAME']))); define('DOMAIN', $_SERVER['HTTP_HOST']); define('PROTOCOLE', isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ? 'https' : 'http'); define('SYSTEM', ROOT . DS . 'system'); define('APP', ROOT . DS . 'app'); define('LANG', ROOT . DS . 'ressources' . DS . 'lang'); session_start(); require_once APP . '/model/PDOConnexion.php'; require_once APP . '/model/App.class.php'; require_once APP . '/model/Capacity.class.php'; header('Content-Type: application/json'); if (isset($_POST['delete']) && isset($_POST['id']) && App::isAdmin()) { Capacity::deleteCapacity(htmlentities($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } echo json_encode(array_merge($_POST, array('status' => 'unknown error'))); die;
<?php if (isset($_GET['id']) && !empty($_GET['id'])) { $id = htmlentities($_GET['id']); $capacity = Capacity::getCapacityById($id); if (isset($_POST['edit'])) { PDOConnexion::setParameters('phonedeals', 'root', 'root'); $db = PDOConnexion::getInstance(); $sql = "\n\t\t\t\tUPDATE capacity\n\t\t\t\tSET storage = :storage\n\t\t\t\tWHERE id = :id\n\t\t\t"; $sth = $db->prepare($sql); $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Capacity'); $sth->execute(array(':id' => $id, ':storage' => $_POST['storage'])); if ($sth) { App::success('Cette capacité a bien été modifiée'); } } if ($capacity) { ?> <div class="col-md-8"> <div class="page-header"> <h1>Éditer une capacité</h1> </div> <form action="index.php?page=admin/capacity-edit&id=<?php echo $id; ?> " method="POST"> <div class="form-group"> <label for="capacity-name">Nom</label> <input type="text" class="form-control" id="capacity-name" value="<?php echo $capacity->storage;
echo "\tphp space.php <ignore-root> \"localhost\" - - - <usage-file> [expand-file] [--force]\n"; echo "\tphp space.php <ignore-root> <hostname> <port> <user> <key> <usage-file> [expand-file] [--force]\n"; die; } $ignore_root = intval($argv[1]); $hostname = $argv[2]; $usage_file = $argv[6]; $expand_directories = empty($argv[7]) ? array() : read_json_array($argv[7]); $force = isset($argv[8]) && $argv[8] === "--force"; if ($hostname != "localhost") { Executor::$host = $hostname; Executor::$port = is_numeric($argv[3]) ? intval($argv[3]) : 22; Executor::$user = $argv[4]; Executor::$key = $argv[5]; } $space = new Capacity(); $mounts1 = list_mounts("type ext"); $mounts2 = list_mounts("type fuse.mfs"); $mounts = array_merge($mounts1, $mounts2); asort($mounts); if (!$force) { $json = read_json_array($usage_file); $usage = $json["usage"]; $capacity = $json["capacity"]; } else { $usage = array(); $capacity = array(); } foreach ($mounts as $partition => $path) { if (in_array($path, $less_often_reports, true) && !$force) { continue;