예제 #1
0
 /**
  * Delete a page
  *
  * @param string $pageUID
  * @throws IOException If the page does not exists
  * @return boolean If page is deleted
  */
 public function delete($pageUID)
 {
     $pageFullPath = $pageUID . $this->fileExtension;
     $fs = new Files($this->folder);
     return $fs->delete($pageFullPath);
 }
예제 #2
0
파일: files.php 프로젝트: bafs/parvula
<?php

namespace Parvula;

use Exception;
use SplFileInfo;
use RuntimeException;
use Parvula\FilesSystem;
use Parvula\Exceptions\IOException;
// @ALPHA.2
$fs = new FilesSystem(_UPLOADS_);
/**
 * @api {get} /files Index files
 * @apiName Index Files
 * @apiGroup Files
 *
 * @apiParam {string} [full] Optional You can pass `?full` to get more details
 *
 * @apiSuccess (200) Array Array of files paths
 */
$this->get('', function ($req, $res) use($fs) {
    ///https://weierophinney.github.io/2015-10-20-PSR-7-and-Middleware/#/35
    //->getUploadedFiles
    try {
        // Detailed view
        if (isset($req->getQueryParams()['full'])) {
            $files = [];
            $fs->index('', function (SplFileInfo $file, $cdir) use(&$files) {
                $files[] = ['filename' => $file->getFileName(), 'path' => (string) $cdir, 'lastedit' => $file->getMTime(), 'size' => $file->getSize(), 'type' => $file->getType()];
            });
            return $this->api->json($res, $files);