Merge branch 'saas' of github.com:sourcefabric/Airtime into saas

This commit is contained in:
Albert Santoni 2015-03-11 18:34:20 -04:00
commit b868e4cd46
5 changed files with 66 additions and 9 deletions

View File

@ -27,10 +27,9 @@ class PluploadController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']);
$this->view->quotaLimitReached = false;
// temporarily disabling disk quota until all file size values have been set
/*if (Application_Model_Systemstatus::isDiskOverQuota()) {
if (Application_Model_Systemstatus::isDiskOverQuota()) {
$this->view->quotaLimitReached = true;
}*/
}
//Because uploads are done via AJAX (and we're not using Zend form for those), we manually add the CSRF
//token in here.

View File

@ -19,6 +19,7 @@ class UpgradeController extends Zend_Controller_Action
array_push($upgraders, new AirtimeUpgrader255());
array_push($upgraders, new AirtimeUpgrader259());
array_push($upgraders, new AirtimeUpgrader2510());
array_push($upgraders, new AirtimeUpgrader2511());
$didWePerformAnUpgrade = false;
try

View File

@ -78,11 +78,9 @@ class CcFiles extends BaseCcFiles {
*/
public static function createFromUpload($fileArray)
{
/*temporarily disabling disk quota until all file sizes have ben set in the database.
if (Application_Model_Systemstatus::isDiskOverQuota()) {
throw new OverDiskQuotaException();
}
*/
/* If full_path is set, the post request came from ftp.
* Users are allowed to upload folders via ftp. If this is the case

View File

@ -14,15 +14,33 @@ class Rest_MediaController extends Zend_Rest_Controller
public function indexAction()
{
$totalFileCount = CcFilesQuery::create()->count();
// Check if offset and limit were sent with request.
// Default limit to zero and offset to $totalFileCount
$offset = $this->_getParam('offset', 0);
$limit = $this->_getParam('limit', $totalFileCount);
$query = CcFilesQuery::create()
->filterByDbHidden(false)
->filterByDbFileExists(true)
->filterByDbImportStatus(0)
->setLimit($limit)
->setOffset($offset)
->orderByDbId();
$queryCount = $query->count();
$queryResult = $query->find();
$files_array = array();
foreach (CcFilesQuery::create()->find() as $file)
foreach ($queryResult as $file)
{
array_push($files_array, CcFiles::sanitizeResponse($file));
}
$this->getResponse()
->setHttpResponseCode(200)
->appendBody(json_encode($files_array));
->setHttpResponseCode(200)
->setHeader('X-TOTAL-COUNT', $queryCount)
->appendBody(json_encode($files_array));
/** TODO: Use this simpler code instead after we upgrade to Propel 1.7 (Airtime 2.6.x branch):
$this->getResponse()

View File

@ -341,3 +341,44 @@ class AirtimeUpgrader2510 extends AirtimeUpgrader
}
}
}
class AirtimeUpgrader2511 extends AirtimeUpgrader
{
protected function getSupportedVersions() {
return array (
'2.5.10'
);
}
public function getNewVersion() {
return '2.5.11';
}
public function upgrade($dir = __DIR__) {
Cache::clear();
assert($this->checkIfUpgradeSupported());
$newVersion = $this->getNewVersion();
try {
$this->toggleMaintenanceScreen(true);
Cache::clear();
// Begin upgrade
$queryResult = CcFilesQuery::create()
->select(array('disk_usage'))
->withColumn('SUM(CcFiles.filesize)', 'disk_usage')
->find();
$disk_usage = $queryResult[0];
Application_Model_Preference::setDiskUsage($disk_usage);
Application_Model_Preference::SetAirtimeVersion($newVersion);
Cache::clear();
$this->toggleMaintenanceScreen(false);
} catch(Exception $e) {
$this->toggleMaintenanceScreen(false);
throw $e;
}
}
}