mirror of
https://github.com/e107inc/e107.git
synced 2025-08-22 14:13:03 +02:00
More work on admin->downloads. Now uses media-manager for images.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
class download_setup
|
||||
{
|
||||
|
||||
function install_pre($var)
|
||||
{
|
||||
// print_a($var);
|
||||
@@ -38,12 +39,60 @@ class download_setup
|
||||
// $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
function upgrade_post($var)
|
||||
|
||||
// IMPORTANT : This function below is for modifying the CONTENT of the tables only, NOT the table-structure.
|
||||
// To Modify the table-structure, simply modify your {plugin}_sql.php file and an update will be detected automatically.
|
||||
/*
|
||||
* @var $needed - true when only a check for a required update is being performed.
|
||||
* Return: Reason the upgrade is required, otherwise set it to return FALSE.
|
||||
*/
|
||||
function upgrade_post($needed)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$mes = eMessage::getInstance();
|
||||
// $mes->add("custom upgrade 'post' function.", E_MESSAGE_SUCCESS);
|
||||
$mes = e107::getMessage();
|
||||
$qry = "SELECT * FROM #download WHERE download_image !='' AND SUBSTRING(download_image, 1, 3) != '{e_' LIMIT 2";
|
||||
|
||||
if($sql->db_Select_gen($qry))
|
||||
{
|
||||
if($needed == TRUE){ return "Incorrect download image paths"; } // Signal that an update is required.
|
||||
|
||||
if($sql->db_Update("download","download_image = CONCAT('{e_FILE}downloadimages/',download_image) WHERE download_image !='' "))
|
||||
{
|
||||
$mes->addSuccess("Updated Download-Image paths");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addError("Failed to update Download-Image paths");
|
||||
}
|
||||
|
||||
if($sql->db_Update("download"," download_thumb = CONCAT('{e_FILE}downloadthumbs/',download_thumb) WHERE download_thumb !='' "))
|
||||
{
|
||||
$mes->addSuccess("Updated Download-Thumbnail paths");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addError("Failed to update Download-Thumbnail paths");
|
||||
}
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM #download_category WHERE download_category_icon !='' AND SUBSTRING(download_category_icon, 1, 3) != '{e_' LIMIT 2";
|
||||
if($sql->db_Select_gen($qry))
|
||||
{
|
||||
// Signal that an update is required.
|
||||
if($needed == TRUE){ return "Downloads-Category icon paths need updating"; } // Must have a value if an update is needed. Text used for debug purposes.
|
||||
|
||||
if($sql->db_Update("download_category","download_category_icon = CONCAT('{e_IMAGE}icons/',download_category_icon) WHERE download_category_icon !='' "))
|
||||
{
|
||||
$mes->addSuccess("Updated Download-Image paths");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addError("Failed to update Download-Image paths");
|
||||
}
|
||||
}
|
||||
|
||||
if($needed == TRUE){ return FALSE; }
|
||||
|
||||
//if(version_compare($var['current_plug']['plugin_version'], "1.2", "<"))
|
||||
//{
|
||||
// $qry = "ALTER TABLE #download ADD download_postclass TINYINT( 3 ) UNSIGNED DEFAULT '0' NOT NULL ;";
|
||||
|
Reference in New Issue
Block a user