mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
https://github.com/WWBN/AVideo/issues/7779
This commit is contained in:
parent
d50a618c41
commit
12a47cb43e
9 changed files with 132 additions and 137 deletions
|
@ -11,12 +11,6 @@ if (!isset($global['systemRootPath'])) {
|
|||
|
||||
$global['bypassSameDomainCheck'] = 1;
|
||||
inputToRequest();
|
||||
/*
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
*/
|
||||
|
||||
_error_log("REQUEST: " . json_encode($_REQUEST));
|
||||
_error_log("POST: " . json_encode($_REQUEST));
|
||||
_error_log("GET: " . json_encode($_GET));
|
||||
|
|
|
@ -1,56 +1,54 @@
|
|||
<?php
|
||||
header('Content-Type: application/json');
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = true;
|
||||
$obj->categories_id = 0;
|
||||
$obj->image1 = 0;
|
||||
$obj->image2 = 0;
|
||||
$obj->usergroups_ids_array = @$_REQUEST['usergroups_ids_array'];
|
||||
|
||||
if (!Category::canCreateCategory()) {
|
||||
$obj->msg = __("Permission denied");
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$objCat = new Category(intval(@$_POST['id']));
|
||||
$objCat->setName($_POST['name']);
|
||||
$objCat->setClean_name($_POST['clean_name']);
|
||||
$objCat->setDescription($_POST['description']);
|
||||
$objCat->setIconClass($_POST['iconClass']);
|
||||
//$objCat->setNextVideoOrder($_POST['nextVideoOrder']);
|
||||
$objCat->setSuggested($_POST['suggested']);
|
||||
$objCat->setParentId($_POST['parentId']);
|
||||
$objCat->setPrivate($_POST['private']);
|
||||
$objCat->setAllow_download($_POST['allow_download']);
|
||||
$objCat->setOrder($_POST['order']);
|
||||
_error_log('CategoryAddnew: Saving '.$_POST['name']);
|
||||
$obj->categories_id = $objCat->save();
|
||||
//$objCat->setType($_POST['type'],$id);
|
||||
|
||||
if (!empty($obj->categories_id)) {
|
||||
_error_log('CategoryAddnew: '.$obj->categories_id);
|
||||
$obj->error = false;
|
||||
$path = Category::getCategoryPhotoPath($obj->categories_id);
|
||||
$obj->image1 = saveCroppieImage($path['path'], "image1");
|
||||
$obj->image1P = $path['path'];
|
||||
_error_log('CategoryAddnew: save image 1 '.$path['path']);
|
||||
$path = Category::getCategoryBackgroundPath($obj->categories_id);
|
||||
$obj->image2 = saveCroppieImage($path['path'], "image2");
|
||||
$obj->image2P = $path['path'];
|
||||
_error_log('CategoryAddnew: save image 2 '.$path['path']);
|
||||
|
||||
// save usergroups
|
||||
_error_log('CategoryAddnew: save usergroups '. json_encode($obj->usergroups_ids_array));
|
||||
Category::setUsergroups($obj->categories_id, $obj->usergroups_ids_array);
|
||||
}
|
||||
die(json_encode($obj));
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = true;
|
||||
$obj->categories_id = 0;
|
||||
$obj->image1 = 0;
|
||||
$obj->image2 = 0;
|
||||
$obj->usergroups_ids_array = @$_REQUEST['usergroups_ids_array'];
|
||||
|
||||
if (!Category::canCreateCategory()) {
|
||||
$obj->msg = __("Permission denied");
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$objCat = new Category(intval(@$_POST['id']));
|
||||
$objCat->setName($_POST['name']);
|
||||
$objCat->setClean_name($_POST['clean_name']);
|
||||
$objCat->setDescription($_POST['description']);
|
||||
$objCat->setIconClass($_POST['iconClass']);
|
||||
//$objCat->setNextVideoOrder($_POST['nextVideoOrder']);
|
||||
$objCat->setSuggested($_POST['suggested']);
|
||||
$objCat->setParentId($_POST['parentId']);
|
||||
$objCat->setPrivate($_POST['private']);
|
||||
$objCat->setAllow_download($_POST['allow_download']);
|
||||
$objCat->setOrder($_POST['order']);
|
||||
_error_log('CategoryAddnew: Saving '.$_POST['name']);
|
||||
$obj->categories_id = $objCat->save();
|
||||
//$objCat->setType($_POST['type'],$id);
|
||||
|
||||
if (!empty($obj->categories_id)) {
|
||||
_error_log('CategoryAddnew: '.$obj->categories_id);
|
||||
$obj->error = false;
|
||||
$path = Category::getCategoryPhotoPath($obj->categories_id);
|
||||
$obj->image1 = saveCroppieImage($path['path'], "image1");
|
||||
$obj->image1P = $path['path'];
|
||||
_error_log('CategoryAddnew: save image 1 '.$path['path']);
|
||||
$path = Category::getCategoryBackgroundPath($obj->categories_id);
|
||||
$obj->image2 = saveCroppieImage($path['path'], "image2");
|
||||
$obj->image2P = $path['path'];
|
||||
_error_log('CategoryAddnew: save image 2 '.$path['path']);
|
||||
|
||||
// save usergroups
|
||||
_error_log('CategoryAddnew: save usergroups '. json_encode($obj->usergroups_ids_array));
|
||||
Category::setUsergroups($obj->categories_id, $obj->usergroups_ids_array);
|
||||
}
|
||||
die(json_encode($obj));
|
||||
|
|
|
@ -10740,3 +10740,13 @@ function getDockerStatsURL()
|
|||
{
|
||||
return getDockerInternalURL() . "stat";
|
||||
}
|
||||
|
||||
function set_error_reporting() {
|
||||
if (!empty($global['debug'])) {
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
}else{
|
||||
error_reporting(E_ERROR);
|
||||
ini_set('display_errors', 0);
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ try {
|
|||
} catch (Exception $exc) {
|
||||
echo $exc->getTraceAsString();
|
||||
}
|
||||
error_reporting(error_reporting() & ~E_DEPRECATED);
|
||||
|
||||
$global['webSiteRootURL'] .= (substr($global['webSiteRootURL'], -1) == '/' ? '' : '/');
|
||||
$global['systemRootPath'] .= (substr($global['systemRootPath'], -1) == '/' ? '' : '/');
|
||||
$global['session_name'] = md5($global['systemRootPath']);
|
||||
|
@ -180,6 +180,7 @@ require_once $global['systemRootPath'] . 'objects/plugin.php';
|
|||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
|
||||
set_error_reporting();
|
||||
setSiteLang();
|
||||
|
||||
adminSecurityCheck();
|
||||
|
|
|
@ -1,67 +1,66 @@
|
|||
<?php
|
||||
$config = dirname(__FILE__) . '/../../../videos/configuration.php';
|
||||
require_once $config;
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
return die('Command Line only');
|
||||
}
|
||||
|
||||
$isCDNEnabled = AVideoPlugin::isEnabledByName('CDN');
|
||||
|
||||
if (empty($isCDNEnabled)) {
|
||||
return die('Plugin disabled');
|
||||
}
|
||||
ob_end_flush();
|
||||
set_time_limit(300);
|
||||
ini_set('max_execution_time', 300);
|
||||
|
||||
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
||||
$path = getVideosDir();
|
||||
$total = Video::getTotalVideos("", false, true, true, false, false);
|
||||
$videos = Video::getAllVideosLight("", false, true, false);
|
||||
$count = 0;
|
||||
|
||||
$countSiteIdEmpty = 0;
|
||||
$countStatusNotActive = 0;
|
||||
$countMoved = 0;
|
||||
|
||||
$sites_id_to_move = [];
|
||||
|
||||
foreach ($videos as $value) {
|
||||
$count++;
|
||||
//echo "{$count}/{$total} Checking {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
||||
if (empty($value['sites_id'])) {
|
||||
$countSiteIdEmpty++;
|
||||
//echo "sites_id is not empty {$value['sites_id']}" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
if ($value['status'] !== Video::$statusActive) {
|
||||
$countStatusNotActive++;
|
||||
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
$countMoved++;
|
||||
$sites_id_to_move[] = $value['id'];
|
||||
echo "{$key}/{$total} added to download {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
||||
}
|
||||
|
||||
$total = count($sites_id_to_move);
|
||||
foreach ($sites_id_to_move as $key => $value) {
|
||||
echo "{$key}/{$total} Start download {$value}" . PHP_EOL;
|
||||
$startF = microtime(true);
|
||||
//$response = CDNStorage::get($value, 10);
|
||||
$response = CDNStorage::moveRemoteToLocal($value, false, false);
|
||||
if (empty($response)) {
|
||||
echo "{$key}/{$total} ERROR " . PHP_EOL;
|
||||
} else {
|
||||
$endF = microtime(true) - $startF;
|
||||
$ETA = ($total - $key + 1) * $endF;
|
||||
$ps = humanFileSize($response['totalBytesTransferred'] / ($endF));
|
||||
echo "{$key}/{$total} download done {$value} filesCopied={$response['filesCopied']} totalBytesTransferred=" . humanFileSize($response['totalBytesTransferred']) . " in " . secondsToDuration($endF) . " ETA: " . secondsToDuration($ETA) . " " . $ps . 'ps' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
echo "SiteIdNotEmpty = $countSiteIdEmpty; StatusNotActive=$countStatusNotActive; Moved=$countMoved;" . PHP_EOL;
|
||||
echo PHP_EOL . " Done! " . PHP_EOL;
|
||||
die();
|
||||
<?php
|
||||
$config = dirname(__FILE__) . '/../../../videos/configuration.php';
|
||||
require_once $config;
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
return die('Command Line only');
|
||||
}
|
||||
|
||||
$isCDNEnabled = AVideoPlugin::isEnabledByName('CDN');
|
||||
|
||||
if (empty($isCDNEnabled)) {
|
||||
return die('Plugin disabled');
|
||||
}
|
||||
ob_end_flush();
|
||||
set_time_limit(300);
|
||||
ini_set('max_execution_time', 300);
|
||||
|
||||
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
||||
$path = getVideosDir();
|
||||
$total = Video::getTotalVideos("", false, true, true, false, false);
|
||||
$videos = Video::getAllVideosLight("", false, true, false);
|
||||
$count = 0;
|
||||
|
||||
$countSiteIdEmpty = 0;
|
||||
$countStatusNotActive = 0;
|
||||
$countMoved = 0;
|
||||
|
||||
$sites_id_to_move = [];
|
||||
|
||||
foreach ($videos as $value) {
|
||||
$count++;
|
||||
//echo "{$count}/{$total} Checking {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
||||
if (empty($value['sites_id'])) {
|
||||
$countSiteIdEmpty++;
|
||||
//echo "sites_id is not empty {$value['sites_id']}" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
if ($value['status'] !== Video::$statusActive) {
|
||||
$countStatusNotActive++;
|
||||
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
$countMoved++;
|
||||
$sites_id_to_move[] = $value['id'];
|
||||
echo "{$key}/{$total} added to download {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
||||
}
|
||||
|
||||
$total = count($sites_id_to_move);
|
||||
foreach ($sites_id_to_move as $key => $value) {
|
||||
echo "{$key}/{$total} Start download {$value}" . PHP_EOL;
|
||||
$startF = microtime(true);
|
||||
//$response = CDNStorage::get($value, 10);
|
||||
$response = CDNStorage::moveRemoteToLocal($value, false, false);
|
||||
if (empty($response)) {
|
||||
echo "{$key}/{$total} ERROR " . PHP_EOL;
|
||||
} else {
|
||||
$endF = microtime(true) - $startF;
|
||||
$ETA = ($total - $key + 1) * $endF;
|
||||
$ps = humanFileSize($response['totalBytesTransferred'] / ($endF));
|
||||
echo "{$key}/{$total} download done {$value} filesCopied={$response['filesCopied']} totalBytesTransferred=" . humanFileSize($response['totalBytesTransferred']) . " in " . secondsToDuration($endF) . " ETA: " . secondsToDuration($ETA) . " " . $ps . 'ps' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
echo "SiteIdNotEmpty = $countSiteIdEmpty; StatusNotActive=$countStatusNotActive; Moved=$countMoved;" . PHP_EOL;
|
||||
echo PHP_EOL . " Done! " . PHP_EOL;
|
||||
die();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
$config = dirname(__FILE__) . '/../../../videos/configuration.php';
|
||||
require_once $config;
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
return die('Command Line only');
|
||||
|
|
|
@ -22,8 +22,6 @@ if (empty($isCDNEnabled)) {
|
|||
ob_end_flush();
|
||||
set_time_limit(0);
|
||||
ini_set('max_execution_time', 0);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
ini_set('display_errors', '1');
|
||||
/**
|
||||
* @var mixed[] $global
|
||||
*/
|
||||
|
|
|
@ -18,8 +18,6 @@ $index = intval(@$argv[2]);
|
|||
ob_end_flush();
|
||||
set_time_limit(300);
|
||||
ini_set('max_execution_time', 300);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
||||
$path = getVideosDir();
|
||||
|
|
|
@ -21,8 +21,6 @@ $_2hours = $_1hour*2;
|
|||
ob_end_flush();
|
||||
set_time_limit($_2hours);
|
||||
ini_set('max_execution_time', $_2hours);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
$sort = @$argv[1];
|
||||
if(strtolower($sort) !== 'asc'){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue