CC-5781: Upgrade script for new storage quota implementation
Removing scripts from public folder (was only there for testing)
This commit is contained in:
parent
661ab7f647
commit
47215eb541
|
@ -1,24 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/* All functions other than start() should be marked as
|
|
||||||
* private.
|
|
||||||
*/
|
|
||||||
class AirtimeDatabaseUpgrade{
|
|
||||||
|
|
||||||
public static function start($p_dbValues){
|
|
||||||
echo "* Updating Database".PHP_EOL;
|
|
||||||
self::task0($p_dbValues);
|
|
||||||
echo " * Complete".PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function task0($p_dbValues){
|
|
||||||
|
|
||||||
$username = $p_dbValues['database']['dbuser'];
|
|
||||||
$password = $p_dbValues['database']['dbpass'];
|
|
||||||
$host = $p_dbValues['database']['host'];
|
|
||||||
$database = $p_dbValues['database']['dbname'];
|
|
||||||
$dir = __DIR__;
|
|
||||||
|
|
||||||
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/data/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class StorageQuotaUpgrade
|
|
||||||
{
|
|
||||||
public static function startUpgrade()
|
|
||||||
{
|
|
||||||
echo "* Updating storage usage for new quota tracking".PHP_EOL;
|
|
||||||
self::setStorageUsage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function setStorageUsage()
|
|
||||||
{
|
|
||||||
$musicDir = CcMusicDirsQuery::create()
|
|
||||||
->filterByType('stor')
|
|
||||||
->filterByExists(true)
|
|
||||||
->findOne();
|
|
||||||
$storPath = $musicDir->getDirectory();
|
|
||||||
|
|
||||||
$f = $storPath;
|
|
||||||
$io = popen('/usr/bin/du -bs ' . $f, 'r');
|
|
||||||
$size = fgets($io, 4096);
|
|
||||||
$size = substr($size, 0, strpos($size, "\t"));
|
|
||||||
pclose($io);
|
|
||||||
|
|
||||||
Application_Model_Preference::setDiskUsage($size);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Define path to application directory
|
|
||||||
defined('APPLICATION_PATH')
|
|
||||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
|
||||||
//include index.php so we can use propel classes
|
|
||||||
require_once APPLICATION_PATH.'/../public/index.php';
|
|
||||||
|
|
||||||
require_once 'DbUpgrade.php';
|
|
||||||
require_once 'StorageQuotaUpgrade.php';
|
|
||||||
|
|
||||||
$filename = "/etc/airtime/airtime.conf";
|
|
||||||
$values = parse_ini_file($filename, true);
|
|
||||||
|
|
||||||
AirtimeDatabaseUpgrade::start($values);
|
|
||||||
StorageQuotaUpgrade::startUpgrade();
|
|
|
@ -1,6 +0,0 @@
|
||||||
DELETE FROM cc_pref WHERE keystr = 'system_version';
|
|
||||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.3');
|
|
||||||
|
|
||||||
ALTER TABLE cc_files DROP COLUMN state;
|
|
||||||
ALTER TABLE cc_files ADD import_status integer default 1; -- Default is "pending"
|
|
||||||
UPDATE cc_files SET import_status=0; -- Existing files are already "imported"
|
|
Loading…
Reference in New Issue