Beispiel #1
0
        // physically delete files marked for deletion
        $this->query('VACUUM');
    }
    /**
     * Get all queues
     * @return IQueue[]
     */
    function getQueues()
    {
        $queuesOut = array();
        $res = $this->query('
            SELECT queueID
            FROM files
            GROUP BY queueID
        ');
        while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
            $queuesOut[] = $this->createQueueObj($row['queueID']);
        }
        return $queuesOut;
    }
    static function init()
    {
        // TODO: remove this magic
        $config = Environment::getConfig('MultipleFileUploader', array('databasePath' => dirname(__FILE__) . '/database.sqlite3', 'uploadsTempDir' => ''));
        foreach ($config as $key => $val) {
            self::${$key} = $val;
        }
    }
}
Queues::init();
Beispiel #2
0
 /**
  * Get upload directory path
  * @return string
  */
 function getUploadedFilesTemporaryPath()
 {
     if (!Queues::$uploadsTempDir) {
         Queues::$uploadsTempDir = Environment::expand("%tempDir%" . DIRECTORY_SEPARATOR . "uploads-MFU");
     }
     if (!file_exists(Queues::$uploadsTempDir)) {
         mkdir(Queues::$uploadsTempDir, 0777, true);
     }
     if (!is_writable(Queues::$uploadsTempDir)) {
         Queues::$uploadsTempDir = Environment::expand("%tempDir%");
     }
     if (!is_writable(Queues::$uploadsTempDir)) {
         throw new InvalidStateException("Directory for temp files is not writable!");
     }
     return Queues::$uploadsTempDir;
 }