Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,26 +12,42 @@
|
||||
namespace IPS\convert;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application as SystemApplication;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Lang;
|
||||
use IPS\Login;
|
||||
use IPS\Member;
|
||||
use IPS\Member\Group;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use UnderflowException;
|
||||
use function defined;
|
||||
use function is_null;
|
||||
use const IPS\DEMO_MODE;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converter Application Class
|
||||
*/
|
||||
class _Application extends \IPS\Application
|
||||
class Application extends SystemApplication
|
||||
{
|
||||
/**
|
||||
* Can the user access this application?
|
||||
*
|
||||
* @param \IPS\Member|\IPS\Member\Group|NULL $memberOrGroup Member/group we are checking against or NULL for currently logged on user
|
||||
* @param Member|Group|NULL $memberOrGroup Member/group we are checking against or NULL for currently logged on user
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccess( $memberOrGroup=NULL )
|
||||
public function canAccess( $memberOrGroup=NULL ): bool
|
||||
{
|
||||
if ( \IPS\DEMO_MODE === TRUE )
|
||||
if ( DEMO_MODE === TRUE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -44,7 +60,7 @@ class _Application extends \IPS\Application
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function get__description()
|
||||
protected function get__description(): ?string
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -53,9 +69,9 @@ class _Application extends \IPS\Application
|
||||
* [Node] Get Icon for tree
|
||||
*
|
||||
* @note Return the class for the icon (e.g. 'globe')
|
||||
* @return string|null
|
||||
* @return string
|
||||
*/
|
||||
protected function get__icon()
|
||||
protected function get__icon(): string
|
||||
{
|
||||
return 'random';
|
||||
}
|
||||
@@ -66,7 +82,7 @@ class _Application extends \IPS\Application
|
||||
* @note Return value NULL indicates the node cannot be enabled/disabled
|
||||
* @return bool|null
|
||||
*/
|
||||
protected function get__locked()
|
||||
protected function get__locked(): ?bool
|
||||
{
|
||||
/* We don't allow the application to be disabled since its hooks are required for redirects */
|
||||
return TRUE;
|
||||
@@ -76,19 +92,19 @@ class _Application extends \IPS\Application
|
||||
* [Node] Get buttons to display in tree
|
||||
* Example code explains return value
|
||||
*
|
||||
* @param string $url Base URL
|
||||
* @param bool $subnode Is this a subnode?
|
||||
* @return array
|
||||
* @param Url $url Base URL
|
||||
* @param bool $subnode Is this a subnode?
|
||||
* @return array
|
||||
*/
|
||||
public function getButtons( $url, $subnode=FALSE )
|
||||
public function getButtons( Url $url, bool $subnode=FALSE ): array
|
||||
{
|
||||
$buttons = parent::getButtons( $url, $subnode );
|
||||
|
||||
if( isset( $buttons['delete'] ) )
|
||||
{
|
||||
$buttons['delete']['title'] = 'uninstall';
|
||||
$buttons['delete']['data']['delete-message'] = \IPS\Member::loggedIn()->language()->addToStack('converter_uninstall');
|
||||
$buttons['delete']['data']['delete-warning'] = \IPS\Member::loggedIn()->language()->addToStack('converter_uninstall_warning');
|
||||
$buttons['delete']['data']['delete-message'] = Member::loggedIn()->language()->addToStack('converter_uninstall');
|
||||
$buttons['delete']['data']['delete-warning'] = Member::loggedIn()->language()->addToStack('converter_uninstall_warning');
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
@@ -105,22 +121,22 @@ class _Application extends \IPS\Application
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->select( '*', 'core_login_methods', array( "login_classname=?", 'IPS\\convert\\Login' ) )->first();
|
||||
Db::i()->select( '*', 'core_login_methods', array( "login_classname=?", 'IPS\\convert\\Login' ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$position = \IPS\Db::i()->select( 'MAX(login_order)', 'core_login_methods' )->first();
|
||||
$position = Db::i()->select( 'MAX(login_order)', 'core_login_methods' )->first();
|
||||
|
||||
$handler = new \IPS\convert\Login;
|
||||
$handler->classname = 'IPS\\convert\\Login';
|
||||
$handler->order = $position + 1;
|
||||
$handler->acp = TRUE;
|
||||
$handler->settings = array( 'auth_types' => \IPS\Login::AUTH_TYPE_EMAIL );
|
||||
$handler->settings = array( 'auth_types' => Login::AUTH_TYPE_EMAIL );
|
||||
$handler->enabled = TRUE;
|
||||
$handler->register = FALSE;
|
||||
$handler->save();
|
||||
|
||||
\IPS\Lang::saveCustom( 'core', "login_method_{$handler->id}", 'Converter' );
|
||||
Lang::saveCustom( 'core', "login_method_{$handler->id}", 'Converter' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +221,7 @@ class _Application extends \IPS\Application
|
||||
|
||||
foreach( $parents AS $app => $tables )
|
||||
{
|
||||
if ( !\is_null( $application ) AND $application != $app )
|
||||
if ( !is_null( $application ) AND $application != $app )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -214,12 +230,12 @@ class _Application extends \IPS\Application
|
||||
{
|
||||
foreach( $tables['tables'] AS $table => $data )
|
||||
{
|
||||
if ( \IPS\Db::i()->checkForTable( $table ) )
|
||||
if ( Db::i()->checkForTable( $table ) )
|
||||
{
|
||||
$column = $data['prefix'] . $data['column'];
|
||||
if ( \IPS\Db::i()->checkForColumn( $table, $column ) === FALSE )
|
||||
if ( Db::i()->checkForColumn( $table, $column ) === FALSE )
|
||||
{
|
||||
\IPS\Db::i()->addColumn( $table, array(
|
||||
Db::i()->addColumn( $table, array(
|
||||
'name' => $column,
|
||||
'type' => 'VARCHAR',
|
||||
'length' => 255,
|
||||
@@ -228,10 +244,10 @@ class _Application extends \IPS\Application
|
||||
}
|
||||
else
|
||||
{
|
||||
$localDefinition = \IPS\Db::i()->getTableDefinition( $table, TRUE );
|
||||
$localDefinition = Db::i()->getTableDefinition( $table, TRUE );
|
||||
if( $localDefinition['columns'][ $column ]['type'] !== 'VARCHAR' )
|
||||
{
|
||||
\IPS\Db::i()->changeColumn( $table, $column, array(
|
||||
Db::i()->changeColumn( $table, $column, array(
|
||||
'name' => $column,
|
||||
'type' => 'VARCHAR',
|
||||
'length' => 255,
|
||||
@@ -293,7 +309,7 @@ class _Application extends \IPS\Application
|
||||
}
|
||||
|
||||
/* SMF */
|
||||
if( \IPS\Request::i()->board OR \IPS\Request::i()->topic OR \IPS\Request::i()->action )
|
||||
if( Request::i()->board OR Request::i()->topic OR Request::i()->action )
|
||||
{
|
||||
static::checkRedirects();
|
||||
}
|
||||
@@ -307,13 +323,13 @@ class _Application extends \IPS\Application
|
||||
public static function checkRedirects()
|
||||
{
|
||||
/* Try each of our converted applications. We will assume the most important conversions were done first */
|
||||
foreach( \IPS\convert\App::apps() as $app )
|
||||
foreach(App::apps() as $app )
|
||||
{
|
||||
try
|
||||
{
|
||||
$redirect = $app->getSource( TRUE, FALSE )->checkRedirects();
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
/* This converter app doesn't exist on disk, this is expected for sites upgraded from 3.x where there isn't a 4.x version of the converter app */
|
||||
continue;
|
||||
@@ -323,7 +339,7 @@ class _Application extends \IPS\Application
|
||||
if( $redirect !== NULL )
|
||||
{
|
||||
/* We got a valid redirect, so send the user there */
|
||||
\IPS\Output::i()->redirect( $redirect, NULL, 301 );
|
||||
Output::i()->redirect( $redirect, NULL, 301 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,16 +12,27 @@
|
||||
namespace IPS\convert\api;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DirectoryIterator;
|
||||
use IPS\Api\Controller;
|
||||
use IPS\Api\Response;
|
||||
use IPS\Lang;
|
||||
use IPS\Request;
|
||||
use ReflectionMethod;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converters API
|
||||
*/
|
||||
class _converters extends \IPS\Api\Controller
|
||||
class converters extends Controller
|
||||
{
|
||||
/**
|
||||
* GET /convert/converters
|
||||
@@ -31,13 +42,13 @@ class _converters extends \IPS\Api\Controller
|
||||
* @apiparam string applications Comma-delimited list of applications to filter by
|
||||
* @return array
|
||||
*/
|
||||
public function GETindex()
|
||||
public function GETindex(): Response
|
||||
{
|
||||
$response = array();
|
||||
$applications = \IPS\Request::i()->applications ? explode( ',', \IPS\Request::i()->applications ) : array();
|
||||
$applications = Request::i()->applications ? explode( ',', Request::i()->applications ) : array();
|
||||
|
||||
/* Loop over software directory to figure out software we can convert */
|
||||
foreach( new \DirectoryIterator( \IPS\ROOT_PATH . '/applications/convert/sources/Software/' ) as $directory )
|
||||
foreach( new DirectoryIterator( \IPS\ROOT_PATH . '/applications/convert/sources/Software/' ) as $directory )
|
||||
{
|
||||
/* Skip ../ and any non-directories */
|
||||
if( $directory->isDot() OR !$directory->isDir() )
|
||||
@@ -46,13 +57,13 @@ class _converters extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Are we filtering by supported applications? */
|
||||
if( \count( $applications ) AND !\in_array( mb_convert_case( $directory->getFilename(), MB_CASE_TITLE ) ) )
|
||||
if( count( $applications ) AND !in_array( mb_convert_case( $directory->getFilename(), MB_CASE_TITLE ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Loop over all of the software in this directory */
|
||||
foreach( new \DirectoryIterator( $directory->getPathname() ) as $softwares )
|
||||
foreach( new DirectoryIterator( $directory->getPathname() ) as $softwares )
|
||||
{
|
||||
/* Skip ../ and any non-files */
|
||||
if( $softwares->isDot() OR !$softwares->isFile() OR mb_substr( $softwares->getFilename(), -3 ) !== 'php' )
|
||||
@@ -101,12 +112,12 @@ class _converters extends \IPS\Api\Controller
|
||||
foreach( $rawConvert as $convertType )
|
||||
{
|
||||
/* Skip extra steps */
|
||||
if( \in_array( $convertType, $extraSteps ) )
|
||||
if( in_array( $convertType, $extraSteps ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$canConvert[] = \IPS\Lang::load( \IPS\Lang::defaultLanguage() )->addToStack(
|
||||
$canConvert[] = Lang::load( Lang::defaultLanguage() )->addToStack(
|
||||
preg_replace_callback( "/([A-Z])/", function( $match ){
|
||||
return "_" . mb_strtolower( $match[1] );
|
||||
}, $convertType )
|
||||
@@ -114,7 +125,7 @@ class _converters extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Reflect the class to figure out if redirects are enabled */
|
||||
$reflect = new \ReflectionMethod( $classname, 'checkRedirects' );
|
||||
$reflect = new ReflectionMethod( $classname, 'checkRedirects' );
|
||||
|
||||
/* Now store the data for this application that we need */
|
||||
$response[ mb_strtolower( $namespace ) ][ mb_strtolower( $application ) ][] = array(
|
||||
@@ -144,6 +155,6 @@ class _converters extends \IPS\Api\Controller
|
||||
/* Sort */
|
||||
ksort( $response );
|
||||
|
||||
return new \IPS\Api\Response( 200, $response );
|
||||
return new Response( 200, $response );
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<build>
|
||||
<module key="admin/manage"><![CDATA[{"default_controller":"manage","protected":0,"default":1}]]></module>
|
||||
<hook key="LoginHandler"><![CDATA[{"type":"C","class":"\\IPS\\Login\\Handler"}]]></hook>
|
||||
<hook key="LegacyParser"><![CDATA[{"type":"C","class":"\\IPS\\Text\\LegacyParser"}]]></hook>
|
||||
<hook key="Db"><![CDATA[{"type":"C","class":"\\IPS\\Db"}]]></hook>
|
||||
<hook key="FrontDispatcher"><![CDATA[{"type":"C","class":"\\IPS\\Dispatcher\\Front"}]]></hook>
|
||||
</build>
|
||||
File renamed without changes.
@@ -18,7 +18,7 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
exit;
|
||||
}
|
||||
|
||||
class _<#CLASS#> extends \IPS\convert\Library
|
||||
class <#CLASS#> extends \IPS\convert\Library
|
||||
{
|
||||
/**
|
||||
* @brief Application
|
||||
|
||||
@@ -18,7 +18,7 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
exit;
|
||||
}
|
||||
|
||||
class _<#CLASS#> extends \IPS\convert\Software
|
||||
class <#CLASS#> extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* Software Name
|
||||
@@ -137,12 +137,14 @@ class _<#CLASS#> extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix post data
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string raw post data
|
||||
* @return string parsed post data
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
{
|
||||
return $post;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javascript app="convert">
|
||||
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/convert" javascript_name="ips.convert.menu.js" javascript_type="controller" javascript_version="107827" javascript_position="1000100">/**
|
||||
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/convert" javascript_name="ips.convert.menu.js" javascript_type="controller" javascript_version="5000026" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
} );
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/forms" javascript_name="ips.forms.reactionmapper.js" javascript_type="controller" javascript_version="107827" javascript_position="1000050">/**
|
||||
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/forms" javascript_name="ips.forms.reactionmapper.js" javascript_type="controller" javascript_version="5000026" javascript_position="1000050">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<app key="convert" version="107827">
|
||||
<app key="convert" version="5000026">
|
||||
<word key="__app_convert" js="0">Converter</word>
|
||||
<word key="menu__convert_manage" js="0">Conversions</word>
|
||||
<word key="menu__convert_manage_manage_start" js="0">Start New Conversion</word>
|
||||
@@ -221,14 +221,6 @@
|
||||
<word key="username_hint" js="0">You can only convert one name, do you want to keep usernames or display names?</word>
|
||||
<word key="convert_member_history" js="0">Convert Member History</word>
|
||||
<word key="_convert_member_history" js="0">Member History</word>
|
||||
<word key="convert_statuses" js="0">Convert Status Updates / Profile Comments</word>
|
||||
<word key="convert_status_replies" js="0">Convert Status Comments</word>
|
||||
<word key="_convert_statuses" js="0">Status Updates / Profile Comments</word>
|
||||
<word key="_convert_status_replies" js="0">Status Comments</word>
|
||||
<word key="status_update_missing_ids" js="0">Status Update Missing ID</word>
|
||||
<word key="status_update_no_member" js="0">No Member ID provided.</word>
|
||||
<word key="status_update_no_author" js="0">No Author ID provided</word>
|
||||
<word key="status_update_no_content" js="0">No comment text</word>
|
||||
<word key="convert_ignored_users" js="0">Convert Ignored Users</word>
|
||||
<word key="_convert_ignored_users" js="0">Ignored Users</word>
|
||||
<word key="ignored_user_missing_ids" js="0">Missing Ignore ID</word>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<theme name="Default" author_name="Invision Power Services, Inc" author_url="https://www.invisioncommunity.com">
|
||||
<template template_group="forms" template_name="reactionmapper" template_data="$name, $value, $cReactions, $ipsReactions, $descriptions" template_location="admin" template_app="convert"><![CDATA[
|
||||
<div class="ipsGrid ipsGrid_collapseTablet ipsGrid_collapsePhone ipsAttachment_fileList ipsContained cReactionMapper" data-ipsGrid data-ipsGrid-equalHeights='row' >
|
||||
<div class="ipsSpanGrid ipsAttachment_fileList cReactionMapper">
|
||||
{{foreach $cReactions as $id => $cReaction}}
|
||||
<div class='ipsGrid_span2 ipsBox ipsAttach ipsImageAttach ipsPad_half' data-controller="convert.admin.forms.reactionmapper" data-reactionid="{$id}">
|
||||
<div class='ipsSpanGrid__2 ipsBox ipsAttach ipsImageAttach i-padding_2' data-controller="convert.admin.forms.reactionmapper" data-reactionid="{$id}">
|
||||
{{if $cReaction['icon']}}
|
||||
<div class='ipsType_center ipsPadding_top:half cReactionImage'>
|
||||
<div class='i-text-align_center i-padding-top_2 cReactionImage'>
|
||||
<img src="{$cReaction['icon']}" alt='' class='ipsImage'>
|
||||
</div>
|
||||
{{endif}}
|
||||
<div class="ipsType_center ipsPad_half">
|
||||
<div class="i-text-align_center i-padding_2">
|
||||
<input type="hidden" value="0" name="{$name}[{$id}]" />
|
||||
<p class='ipsType_center'>{$cReaction['title']|raw}</p>
|
||||
<p class='i-text-align_center'>{$cReaction['title']|raw}</p>
|
||||
<div>
|
||||
<a href='#elReactionMapper{$id}_menu' id='elReactionMapper{$id}' class='ipsButton ipsButton_normal ipsButton_small ipsButton_fullWidth' data-ipsMenu><span class="elMenuSelect_replace">{lang="convert_reaction_choose"}</span> <i class='fa fa-caret-down'></i></a>
|
||||
<a href='#elReactionMapper{$id}_menu' id='elReactionMapper{$id}' class='ipsButton ipsButton--secondary ipsButton--small ipsButton--wide' data-ipsMenu><span class="elMenuSelect_replace">{lang="convert_reaction_choose"}</span> <i class='fa-solid fa-caret-down'></i></a>
|
||||
</div>
|
||||
<ul id='elReactionMapper{$id}_menu' role='menu' class='ipsMenu ipsMenu_auto ipsMenu_withStem ipsHide'>
|
||||
{{foreach $ipsReactions as $reactionId => $reaction}}
|
||||
@@ -25,8 +25,8 @@
|
||||
{{endforeach}}
|
||||
</div>]]></template>
|
||||
<template template_group="forms" template_name="settingsToConvert" template_data="$settingsToConvert" template_location="admin" template_app="convert"><![CDATA[
|
||||
<div class='ipsMessage ipsMessage_info'>{lang="converting_settings_desc"}</div>
|
||||
<ul class='ipsPad'>
|
||||
<div class='ipsMessage ipsMessage--info'>{lang="converting_settings_desc"}</div>
|
||||
<ul class='i-padding_3'>
|
||||
{{foreach $settingsToConvert AS $setting}}
|
||||
<li><em>{$setting['title']}</em> {lang="to"} <em>{$setting['our_title']}</em>: {$setting['value']}</li>
|
||||
{{endforeach}}
|
||||
@@ -34,7 +34,7 @@
|
||||
<template template_group="table" template_name="convertMenuRow" template_data="$table, $headers, $rows" template_location="admin" template_app="convert"><![CDATA[{{$softwareClass = $table->extra['softwareClass'];}}
|
||||
{{foreach $rows as $r}}
|
||||
<form action='{url="app=convert&module=manage&controller=convert&do=runStep&id={$table->extra['appClass']->app_id}&method={$r['step_method']}"}' method='post' data-controller='convert.admin.convert.menu'>
|
||||
<tr class='ipsClearfix' data-keyNavBlock>
|
||||
<tr class='' data-keyNavBlock>
|
||||
{{foreach $r as $k => $v}}
|
||||
{{if $k === 'per_cycle'}}
|
||||
<td>
|
||||
@@ -48,22 +48,22 @@
|
||||
<td>
|
||||
<input type="hidden" name="csrfKey" value="{expression="\IPS\Session::i()->csrfKey"}">
|
||||
{{if \in_array( $r['step_method'], $table->extra['sessionData']['completed'] )}}
|
||||
<input class='ipsButton ipsButton_normal ipsButton_verySmall' type='submit' name='submit' value='{lang="convert_again"}' />
|
||||
<input class='ipsButton ipsButton--secondary ipsButton--tiny' type='submit' name='submit' value='{lang="convert_again"}' />
|
||||
{{if \IPS\IN_DEV == TRUE}}
|
||||
<a href='{url="app=convert&module=manage&controller=convert&do=emptyData&id={$table->extra['appClass']->app_id}&method={$r['step_method']}" csrf="true"}' class='ipsButton ipsButton_normal ipsButton_verySmall ipsButton_alternate' data-action='remove_converted_data'>{lang="remove_converted_data"}</a>
|
||||
<a href='{url="app=convert&module=manage&controller=convert&do=emptyData&id={$table->extra['appClass']->app_id}&method={$r['step_method']}" csrf="true"}' class='ipsButton ipsButton--secondary ipsButton--tiny ipsButton--secondary' data-action='remove_converted_data'>{lang="remove_converted_data"}</a>
|
||||
{{endif}}
|
||||
{{if \in_array( $r['step_method'], $softwareClass::checkConf() )}}
|
||||
<br><input type='checkbox' name='reconfigure' id='reconfigure_{$r['step_method']}' value='1' /> <label for='reconfigure_{$r['step_method']}'>{lang="reconfigure"}</label>
|
||||
{{endif}}
|
||||
{{elseif \count( array_filter( $table->extra['menuRows'][$r['step_method']]['dependencies'], array( $table->extra['appClass'], 'dependencies' ) ) )}}
|
||||
<a href='#' class='ipsButton ipsButton_normal ipsButton_disabled ipsButton_verySmall' data-ipsTooltip title='{lang="cannot_convert_desc"}'>{lang="cannot_convert"}</a>
|
||||
<a href='#' class='ipsButton ipsButton--secondary ipsButton--disabled ipsButton--tiny' data-ipsTooltip title='{lang="cannot_convert_desc"}'>{lang="cannot_convert"}</a>
|
||||
{{elseif array_key_exists( $r['step_method'], $table->extra['sessionData']['working'] )}}
|
||||
<input type='hidden' name='continue' value='1' />
|
||||
<input type='submit' class='ipsButton ipsButton_normal ipsButton_verySmall' name='submit' value='{lang="continue_conversion"}' />
|
||||
<input type='submit' class='ipsButton ipsButton--secondary ipsButton--tiny' name='submit' value='{lang="continue_conversion"}' />
|
||||
{{else}}
|
||||
<input class='ipsButton ipsButton_normal ipsButton_verySmall' type='submit' name='submit' value='{lang="begin_conversion"}' />
|
||||
<input class='ipsButton ipsButton--secondary ipsButton--tiny' type='submit' name='submit' value='{lang="begin_conversion"}' />
|
||||
{{endif}}
|
||||
<div id='elReconvertForm_{$v}' class='ipsPad ipsHide'>
|
||||
<div id='elReconvertForm_{$v}' class='i-padding_3 ipsHide'>
|
||||
{lang="confirm_reconvert"}<br>
|
||||
<ul>
|
||||
{{foreach $table->extra['menuRows'] AS $step}}
|
||||
@@ -76,7 +76,7 @@
|
||||
</div>
|
||||
</td>
|
||||
{{else}}
|
||||
<td class='{{if $k === 'photo'}}ipsTable_icon{{endif}} {{if $k === $table->mainColumn}}ipsTable_primary ipsType_break{{endif}} {{if $k === '_buttons'}}ipsTable_controls{{endif}}' {{if $k !== $table->mainColumn && $k !== '_buttons' && $k !== 'photo'}}data-title="{lang="{$table->langPrefix}{$k}"}"{{endif}}>
|
||||
<td class='{{if $k === 'photo'}}ipsTable_icon{{endif}} {{if $k === $table->mainColumn}}ipsTable_primary{{endif}} {{if $k === '_buttons'}}ipsTable_controls{{endif}}' {{if $k !== $table->mainColumn && $k !== '_buttons' && $k !== 'photo'}}data-title="{lang="{$table->langPrefix}{$k}"}"{{endif}}>
|
||||
{{if $k === '_buttons'}}
|
||||
{template="controlStrip" params="$v" group="global" app="core"}
|
||||
{{else}}
|
||||
@@ -89,11 +89,11 @@
|
||||
</form>
|
||||
{{endforeach}}]]></template>
|
||||
<template template_group="table" template_name="postConversionInformation" template_data="$info" template_location="admin" template_app="convert"><![CDATA[
|
||||
<div class='ipsMessage ipsMessage_info'>
|
||||
<div class='ipsMessage ipsMessage--info'>
|
||||
{$info|raw}
|
||||
</div>]]></template>
|
||||
<template template_group="table" template_name="settingsMessage" template_data="$app" template_location="admin" template_app="convert"><![CDATA[{{$url = \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=settings&id={$app->app_id}" );}}
|
||||
<div class='ipsMessage ipsMessage_info'>
|
||||
<div class='ipsMessage ipsMessage--info'>
|
||||
{lang="converter_supports_settings_link" sprintf="$url"}
|
||||
</div>]]></template>
|
||||
<css css_location="admin" css_app="convert" css_attributes="" css_path="." css_name="convert.css">/* Make the reputation images NOT huge */
|
||||
@@ -117,6 +117,6 @@ img.cReactionSmall
|
||||
|
||||
a:not(.ipsButton) img.cReactionSmall
|
||||
{
|
||||
margin-right: 10px;
|
||||
margin-inline-end: 10px;
|
||||
}</css>
|
||||
</theme>
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -1,236 +1,4 @@
|
||||
{
|
||||
"31003": "1.2.0",
|
||||
"32001": "1.2.2",
|
||||
"33001": "1.2.3",
|
||||
"34000": "1.2.4",
|
||||
"34100": "1.2.5",
|
||||
"34200": "1.2.6",
|
||||
"34300": "1.2.7",
|
||||
"34400": "1.2.8",
|
||||
"34500": "1.2.9",
|
||||
"34600": "1.2.10",
|
||||
"34700": "1.2.11",
|
||||
"34800": "1.2.12",
|
||||
"34900": "1.2.13",
|
||||
"34901": "1.2.14",
|
||||
"34902": "1.2.15",
|
||||
"100000": "4.0.0",
|
||||
"101000": "4.1.0 Beta 1",
|
||||
"101001": "4.1.0 Beta 2",
|
||||
"101002": "4.1.0 Beta 3",
|
||||
"101003": "4.1.0",
|
||||
"101004": "4.1.1",
|
||||
"101005": "4.1.2",
|
||||
"101006": "4.1.3",
|
||||
"101007": "4.1.4",
|
||||
"101008": "4.1.5",
|
||||
"101009": "4.1.6",
|
||||
"101010": "4.1.7",
|
||||
"101011": "4.1.8",
|
||||
"101012": "4.1.9",
|
||||
"101070": "4.1.16.1",
|
||||
"101071": "4.1.17 Beta 1",
|
||||
"101072": "4.1.17 Beta 1a",
|
||||
"101073": "4.1.17 Beta 1b",
|
||||
"101074": "4.1.17 Beta 2",
|
||||
"101075": "4.1.17 Beta 3",
|
||||
"101076": "4.1.17 Beta 3",
|
||||
"101077": "4.1.17",
|
||||
"101078": "4.1.17.1",
|
||||
"101079": "4.1.18 Beta 1",
|
||||
"101082": "4.1.18 Beta 1b",
|
||||
"101083": "4.1.18 Beta 2",
|
||||
"101084": "4.1.18 Beta 3",
|
||||
"101085": "4.1.18",
|
||||
"101088": "4.1.18.1",
|
||||
"101089": "4.1.18.2",
|
||||
"101090": "4.1.19 Beta 1",
|
||||
"101091": "4.1.19 Beta 2",
|
||||
"101092": "4.1.19 Beta 3",
|
||||
"101093": "4.1.19",
|
||||
"101094": "4.1.19.1",
|
||||
"101095": "4.1.19.2 Beta 1",
|
||||
"101096": "4.1.19.2",
|
||||
"101097": "4.1.19.2",
|
||||
"101098": "4.1.19.3",
|
||||
"101099": "4.1.19.4",
|
||||
"101100": "4.2.0 Beta 1",
|
||||
"101101": "4.2.0 Beta 1",
|
||||
"101102": "4.2.0 Beta 1",
|
||||
"101103": "4.2.0 Beta 1",
|
||||
"101104": "4.2.0 Beta 2",
|
||||
"101105": "4.2.0 Beta 3",
|
||||
"101106": "4.2.0 Beta 3a",
|
||||
"101107": "4.2.0 Beta 4",
|
||||
"101108": "4.2.0 Beta 4",
|
||||
"101109": "4.2.0 Beta 5",
|
||||
"101110": "4.2.0 Beta 5a",
|
||||
"101112": "4.2.0 Beta 6a",
|
||||
"101113": "4.2.0 Beta 6a",
|
||||
"101114": "4.2.0 Beta 7",
|
||||
"101115": "4.2.0 Beta 7a",
|
||||
"101116": "4.2.0 Beta 8",
|
||||
"101117": "4.2.0 Beta 8",
|
||||
"102000": "4.2.0",
|
||||
"102001": "4.2.0",
|
||||
"102002": "4.2.0",
|
||||
"102003": "4.2.0",
|
||||
"102004": "4.2.1",
|
||||
"102005": "4.2.2 Beta 1",
|
||||
"102006": "4.2.2 Beta 2",
|
||||
"102007": "4.2.2",
|
||||
"102008": "4.2.2",
|
||||
"102009": "4.2.2",
|
||||
"102010": "4.2.3 Beta 1",
|
||||
"102011": "4.2.3",
|
||||
"102012": "4.2.3",
|
||||
"102013": "4.2.3",
|
||||
"102014": "4.2.4 Beta 1",
|
||||
"102015": "4.2.4 Beta 2",
|
||||
"102016": "4.2.4",
|
||||
"102017": "4.2.4",
|
||||
"102018": "4.2.4",
|
||||
"102019": "4.2.4",
|
||||
"102020": "4.2.4",
|
||||
"102021": "4.2.5 Beta 1",
|
||||
"102022": "4.2.5 Beta 2",
|
||||
"102023": "4.2.5 Beta 3",
|
||||
"102024": "4.2.5",
|
||||
"102025": "4.2.5",
|
||||
"102026": "4.2.5",
|
||||
"102027": "4.2.5",
|
||||
"102028": "4.2.5",
|
||||
"102029": "4.2.5",
|
||||
"102030": "4.2.6 Beta 1",
|
||||
"102031": "4.2.6 Beta 1",
|
||||
"102032": "4.2.6 Beta 2",
|
||||
"102033": "4.2.6 Beta 3",
|
||||
"102034": "4.2.6",
|
||||
"102035": "4.2.6",
|
||||
"102036": "4.2.6",
|
||||
"102037": "4.2.7 Beta 1",
|
||||
"102038": "4.2.7 Beta 2",
|
||||
"102039": "4.2.7 Beta 3",
|
||||
"102040": "4.2.7 Beta 4",
|
||||
"102041": "4.2.7 Beta 5",
|
||||
"102042": "4.2.7",
|
||||
"102043": "4.2.7",
|
||||
"102044": "4.2.7",
|
||||
"102045": "4.2.7",
|
||||
"102046": "4.2.7",
|
||||
"102047": "4.2.8",
|
||||
"102048": "4.2.8",
|
||||
"102049": "4.2.9",
|
||||
"103000": "4.3.0 Beta 1",
|
||||
"103002": "4.3.0 Beta 2",
|
||||
"103003": "4.3.0 Beta 3",
|
||||
"103004": "4.3.0 Beta 4",
|
||||
"103005": "4.3.0",
|
||||
"103006": "4.3.1",
|
||||
"103007": "4.3.1",
|
||||
"103008": "4.3.1",
|
||||
"103009": "4.3.2",
|
||||
"103010": "4.3.2",
|
||||
"103011": "4.3.3",
|
||||
"103012": "4.3.3",
|
||||
"103013": "4.3.3",
|
||||
"103014": "4.3.3",
|
||||
"103015": "4.3.3",
|
||||
"103016": "4.3.3",
|
||||
"103017": "4.3.3",
|
||||
"103018": "4.3.3",
|
||||
"103019": "4.3.3",
|
||||
"103020": "4.3.3",
|
||||
"103021": "4.3.4",
|
||||
"103022": "4.3.4",
|
||||
"103023": "4.3.4",
|
||||
"103024": "4.3.4",
|
||||
"103025": "4.3.4",
|
||||
"103026": "4.3.5 Beta 1",
|
||||
"103027": "4.3.5 Beta 2",
|
||||
"103028": "4.3.5",
|
||||
"103029": "4.3.5",
|
||||
"103030": "4.3.5",
|
||||
"103031": "4.3.5",
|
||||
"103032": "4.3.5",
|
||||
"103033": "4.3.6 Beta 1",
|
||||
"103034": "4.3.6 Beta 2",
|
||||
"103035": "4.3.6",
|
||||
"103036": "4.3.6",
|
||||
"103037": "4.3.6",
|
||||
"103038": "4.3.6",
|
||||
"103039": "4.3.6",
|
||||
"104000": "4.4.0 Beta 1",
|
||||
"104001": "4.4.0 Beta 2",
|
||||
"104002": "4.4.0 Beta 3",
|
||||
"104004": "4.4.0 Beta 4",
|
||||
"104003": "4.4.0 Beta 4",
|
||||
"104005": "4.4.0",
|
||||
"104006": "4.4.0",
|
||||
"104007": "4.4.0",
|
||||
"104008": "4.4.0",
|
||||
"104009": "4.4.1",
|
||||
"104010": "4.4.1 Beta 2",
|
||||
"104011": "4.4.1",
|
||||
"104012": "4.4.1",
|
||||
"104013": "4.4.1",
|
||||
"104014": "4.4.1",
|
||||
"104015": "4.4.2 Beta 1",
|
||||
"104016": "4.4.2",
|
||||
"104017": "4.4.2",
|
||||
"104018": "4.4.2",
|
||||
"104019": "4.4.2",
|
||||
"104020": "4.4.2",
|
||||
"104021": "4.4.3 Beta 1",
|
||||
"104022": "4.4.3 Beta 2",
|
||||
"104023": "4.4.3",
|
||||
"104024": "4.4.3",
|
||||
"104025": "4.4.3",
|
||||
"104026": "4.4.4 Beta 1",
|
||||
"104027": "4.4.4",
|
||||
"104028": "4.4.4",
|
||||
"104029": "4.4.4",
|
||||
"104030": "4.4.5 Beta 1",
|
||||
"104031": "4.4.5 Beta 2",
|
||||
"104032": "4.4.5 Beta 2",
|
||||
"104033": "4.4.5",
|
||||
"104034": "4.4.5",
|
||||
"104035": "4.4.5",
|
||||
"104036": "4.4.5",
|
||||
"104037": "4.4.5",
|
||||
"104038": "4.4.6",
|
||||
"104039": "4.4.6",
|
||||
"104040": "4.4.6",
|
||||
"104041": "4.4.7 Beta 1",
|
||||
"104042": "4.4.7 Beta 2",
|
||||
"104043": "4.4.7 Beta 3",
|
||||
"104044": "4.4.7",
|
||||
"104045": "4.4.8 Beta 1",
|
||||
"104046": "4.4.8 Beta 2",
|
||||
"104047": "4.4.8",
|
||||
"104048": "4.4.9 Beta 1",
|
||||
"104049": "4.4.9",
|
||||
"104050": "4.4.9",
|
||||
"104051": "4.4.9",
|
||||
"104052": "4.4.9",
|
||||
"104053": "4.4.9.1",
|
||||
"104054": "4.4.9.1",
|
||||
"104055": "4.4.9.2",
|
||||
"104056": "4.4.9.2",
|
||||
"104057": "4.4.10 Beta 1",
|
||||
"104058": "4.4.10 Beta 2",
|
||||
"104059": "4.4.10 Beta 3",
|
||||
"104060": "4.4.10 Beta 4",
|
||||
"104061": "4.4.10",
|
||||
"104062": "4.4.10",
|
||||
"104063": "4.4.10",
|
||||
"104064": "4.4.10",
|
||||
"104065": "4.4.10",
|
||||
"104066": "4.4.10",
|
||||
"104067": "4.4.10",
|
||||
"104068": "4.4.10",
|
||||
"104069": "4.4.10",
|
||||
"104070": "4.4.11",
|
||||
"105013": "4.5.0 Beta 1",
|
||||
"105014": "4.5.0 Beta 1",
|
||||
"105015": "4.5.0 Beta 2",
|
||||
@@ -482,41 +250,30 @@
|
||||
"107751": "4.7.16",
|
||||
"107760": "4.7.17 Beta 1",
|
||||
"107761": "4.7.17 Beta 2",
|
||||
"107762": "4.7.17 Beta 3",
|
||||
"107763": "4.7.17",
|
||||
"107764": "4.7.17",
|
||||
"107765": "4.7.17",
|
||||
"107770": "4.7.18 Beta 1",
|
||||
"107771": "4.7.18 Beta 2",
|
||||
"107772": "4.7.18 Beta 3",
|
||||
"107773": "4.7.18",
|
||||
"107774": "4.7.18",
|
||||
"107775": "4.7.18",
|
||||
"107780": "4.7.19 Beta 1",
|
||||
"107781": "4.7.19 Beta 2",
|
||||
"107782": "4.7.19 Beta 3",
|
||||
"107783": "4.7.19 Beta 4",
|
||||
"107784": "4.7.19",
|
||||
"107785": "4.7.19",
|
||||
"107786": "4.7.19",
|
||||
"107787": "4.7.19",
|
||||
"107795": "4.7.20 Beta 1",
|
||||
"107796": "4.7.20 Beta 2",
|
||||
"107797": "4.7.20 Beta 3",
|
||||
"107798": "4.7.20 Beta 4",
|
||||
"107799": "4.7.20 Beta 5",
|
||||
"107800": "4.7.20",
|
||||
"107801": "4.7.20",
|
||||
"107802": "4.7.20",
|
||||
"107803": "4.7.20",
|
||||
"107810": "4.7.21 Beta 1",
|
||||
"107811": "4.7.21",
|
||||
"107815": "4.7.22 Beta 1",
|
||||
"107816": "4.7.22 Beta 2",
|
||||
"107817": "4.7.22",
|
||||
"107818": "4.7.22",
|
||||
"107819": "4.7.22",
|
||||
"107820": "4.7.22",
|
||||
"107826": "4.7.23 Beta 1",
|
||||
"107827": "4.7.23"
|
||||
"500001": "5.0.0 Alpha 1",
|
||||
"500002": "5.0.0 Alpha 2",
|
||||
"5000003": "5.0.0 Alpha 3",
|
||||
"5000004": "5.0.0 Alpha 4",
|
||||
"5000005": "5.0.0 Alpha 5",
|
||||
"5000006": "5.0.0 Alpha 5",
|
||||
"5000007": "5.0.0 Alpha 5",
|
||||
"5000008": "5.0.0 Alpha 5",
|
||||
"5000009": "5.0.0 Alpha 6",
|
||||
"5000010": "5.0.0 Alpha 7",
|
||||
"5000011": "5.0.0 Alpha 8",
|
||||
"5000012": "5.0.0 Alpha 9",
|
||||
"5000013": "5.0.0 Alpha 9",
|
||||
"5000014": "5.0.0 Alpha 9",
|
||||
"5000015": "5.0.0 Alpha 10",
|
||||
"5000016": "5.0.0 Alpha 11",
|
||||
"5000017": "5.0.0 Alpha 11",
|
||||
"5000018": "5.0.0 Alpha 12",
|
||||
"5000019": "5.0.0 Alpha 12",
|
||||
"5000020": "5.0.0 Alpha 12",
|
||||
"5000021": "5.0.0 Alpha 13",
|
||||
"5000022": "5.0.0 Alpha 14",
|
||||
"5000023": "5.0.0 Alpha 15",
|
||||
"5000024": "5.0.0 Alpha 16",
|
||||
"5000025": "5.0.0 Alpha 16",
|
||||
"5000026": "5.0.0 Beta 1"
|
||||
}
|
||||
@@ -13,30 +13,43 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Db;
|
||||
use IPS\forums\Topic\ArchivedPost;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use UnderflowException;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _DeleteEmptyTopics
|
||||
class DeleteEmptyTopics
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
try
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(tid)', 'forums_topics', array( 'forums_posts.pid IS NULL' ) )->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(tid)', 'forums_topics', array( 'forums_posts.pid IS NULL' ) )->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid' )->first();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
@@ -57,28 +70,28 @@ class _DeleteEmptyTopics
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
if ( !class_exists( 'IPS\forums\Topic' ) OR !\IPS\Application::appisEnabled( 'forums' ) )
|
||||
if ( !class_exists( 'IPS\forums\Topic' ) OR !Application::appisEnabled( 'forums' ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
/* If app was removed, then cancel this */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$last = NULL;
|
||||
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'forums_topics', array( "tid>? AND forums_posts.pid IS NULL", $offset ), "tid ASC", array( 0, \IPS\REBUILD_SLOW ) )->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid' ), 'IPS\forums\Topic' ) AS $topic )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'forums_topics', array( "tid>? AND forums_posts.pid IS NULL", $offset ), "tid ASC", array( 0, REBUILD_SLOW ) )->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid' ), 'IPS\forums\Topic' ) AS $topic )
|
||||
{
|
||||
$tid = $topic->tid;
|
||||
|
||||
@@ -106,10 +119,10 @@ class _DeleteEmptyTopics
|
||||
try
|
||||
{
|
||||
/* Do we have any posts? This is more efficient than running a COUNT(*) query, funny enough */
|
||||
\IPS\forums\Topic\ArchivedPost::db()->select( 'archive_id', 'forums_archive_posts', array( "archive_topic_id=?", $topic->tid ), NULL, 1 )->first();
|
||||
ArchivedPost::db()->select( 'archive_id', 'forums_archive_posts', array( "archive_topic_id=?", $topic->tid ), NULL, 1 )->first();
|
||||
}
|
||||
/* This topic is empty */
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$topic->delete();
|
||||
}
|
||||
@@ -121,7 +134,7 @@ class _DeleteEmptyTopics
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -134,8 +147,8 @@ class _DeleteEmptyTopics
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaning task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_deleting_empty_topics' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_deleting_empty_topics' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,33 +12,51 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DOMElement;
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Log;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Settings;
|
||||
use IPS\Text\DOMParser;
|
||||
use IPS\Xml\DOMDocument;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _InvisionCommunityRebuildContent
|
||||
class InvisionCommunityRebuildContent
|
||||
{
|
||||
/**
|
||||
* @brief Number of content items to rebuild per cycle
|
||||
*/
|
||||
public $rebuild = \IPS\REBUILD_SLOW;
|
||||
public $rebuild = REBUILD_SLOW;
|
||||
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$classname = $data['class'];
|
||||
|
||||
\IPS\Log::debug( "Getting preQueueData for " . $classname, 'ICrebuildPosts' );
|
||||
Log::debug( "Getting preQueueData for " . $classname, 'ICrebuildPosts' );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -48,12 +66,12 @@ class _InvisionCommunityRebuildContent
|
||||
/* We're going to use the < operator, so we need to ensure the most recent item is rebuilt */
|
||||
$data['runPid'] = $data['count'] + 1;
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
catch( Exception $ex )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
\IPS\Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'ICrebuildPosts' );
|
||||
Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'ICrebuildPosts' );
|
||||
|
||||
if( $data['count'] == 0 )
|
||||
{
|
||||
@@ -73,11 +91,11 @@ class _InvisionCommunityRebuildContent
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
$classname = $data['class'];
|
||||
$exploded = explode( '\\', $classname );
|
||||
if ( !class_exists( $classname ) or !\IPS\Application::appIsEnabled( $exploded[1] ) )
|
||||
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
@@ -91,7 +109,7 @@ class _InvisionCommunityRebuildContent
|
||||
/* Intentionally no try/catch as it means app doesn't exist */
|
||||
try
|
||||
{
|
||||
$this->app = \IPS\convert\App::load( $data['app'] );
|
||||
$this->app = App::load( $data['app'] );
|
||||
|
||||
/* This extension is ONLY for InvisionCommunity conversions */
|
||||
if( $this->app->app_key != 'invisioncommunity' )
|
||||
@@ -99,18 +117,18 @@ class _InvisionCommunityRebuildContent
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
|
||||
$softwareClass = $this->app->getSource( FALSE, FALSE );
|
||||
|
||||
\IPS\Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'ICrebuildPosts' );
|
||||
Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'ICrebuildPosts' );
|
||||
|
||||
$where = ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? ( \is_array( $classname::commentWhere() ) ? array( $classname::commentWhere() ) : array() ) : array();
|
||||
$where = ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? ( is_array( $classname::commentWhere() ) ? array( $classname::commentWhere() ) : array() ) : array();
|
||||
$select = $classname::db()->select( '*', $classname::$databaseTable, array_merge( $where, array( array( $classname::$databasePrefix . $classname::$databaseColumnId . ' < ?', $data['runPid'] ) ) ), $classname::$databasePrefix . $classname::$databaseColumnId . ' DESC', array( 0, $this->rebuild ) );
|
||||
$iterator = new \IPS\Patterns\ActiveRecordIterator( $select, $classname );
|
||||
$iterator = new ActiveRecordIterator( $select, $classname );
|
||||
$last = NULL;
|
||||
|
||||
foreach( $iterator as $item )
|
||||
@@ -123,7 +141,7 @@ class _InvisionCommunityRebuildContent
|
||||
/* Just checking, we don't actually need anything */
|
||||
$this->app->checkLink( $item->$idColumn, $data['link'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$last = $item->$idColumn;
|
||||
$data['indexed']++;
|
||||
@@ -132,8 +150,8 @@ class _InvisionCommunityRebuildContent
|
||||
|
||||
$contentColumn = $classname::$databaseColumnMap['content'];
|
||||
|
||||
$source = new \IPS\Xml\DOMDocument( '1.0', 'UTF-8' );
|
||||
$source->loadHTML( \IPS\Xml\DOMDocument::wrapHtml( $item->$contentColumn ) );
|
||||
$source = new DOMDocument( '1.0', 'UTF-8' );
|
||||
$source->loadHTML( DOMDocument::wrapHtml( $item->$contentColumn ) );
|
||||
|
||||
if( mb_stristr( $item->$contentColumn, 'data-mentionid' ) )
|
||||
{
|
||||
@@ -180,7 +198,7 @@ class _InvisionCommunityRebuildContent
|
||||
}
|
||||
|
||||
/* Get DOMDocument output */
|
||||
$content = \IPS\Text\DOMParser::getDocumentBodyContents( $source );
|
||||
$content = DOMParser::getDocumentBodyContents( $source );
|
||||
|
||||
/* Replace file storage tags */
|
||||
$content = preg_replace( '/<fileStore\.([\d\w\_]+?)>/i', '<fileStore.$1>', $content );
|
||||
@@ -213,27 +231,27 @@ class _InvisionCommunityRebuildContent
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
* @throws \OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
$class = $data['class'];
|
||||
$exploded = explode( '\\', $class );
|
||||
if ( !class_exists( $class ) or !\IPS\Application::appIsEnabled( $exploded[1] ) )
|
||||
if ( !class_exists( $class ) or !Application::appIsEnabled( $exploded[1] ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack('rebuilding_stuff', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $class::$title . '_pl', FALSE, array( 'strtolower' => TRUE ) ) ) ) ), 'complete' => $data['realCount'] ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack('rebuilding_stuff', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl', FALSE, array( 'strtolower' => TRUE ) ) ) ) ), 'complete' => $data['realCount'] ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : 100 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update mentions with new display name, ID and URL
|
||||
*
|
||||
* @param \DOMElement $element DOM element
|
||||
* @param DOMElement $element DOM element
|
||||
* @return void
|
||||
*/
|
||||
public function updateMention( \DOMElement $element )
|
||||
public function updateMention( DOMElement $element )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -241,14 +259,14 @@ class _InvisionCommunityRebuildContent
|
||||
$newMemberId = $this->app->getLink( $element->getAttribute( 'data-mentionid' ), 'core_members' );
|
||||
|
||||
/* Get new member */
|
||||
$member = \IPS\Member::load( $newMemberId );
|
||||
$member = Member::load( $newMemberId );
|
||||
|
||||
$element->setAttribute( 'data-mentionid', $newMemberId );
|
||||
$element->setAttribute( 'href', str_replace( \IPS\Settings::i()->base_url, '<___base_url___>/', $member->url() ) );
|
||||
$element->setAttribute( 'data-ipshover-target', str_replace( \IPS\Settings::i()->base_url, '<___base_url___>/', $member->url()->setQueryString( 'do', 'hovercard' ) ) );
|
||||
$element->setAttribute( 'href', str_replace( Settings::i()->base_url, '<___base_url___>/', $member->url() ) );
|
||||
$element->setAttribute( 'data-ipshover-target', str_replace( Settings::i()->base_url, '<___base_url___>/', $member->url()->setQueryString( 'do', 'hovercard' ) ) );
|
||||
$element->nodeValue = '@' . $member->name;
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
catch( Exception $e ) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -259,16 +277,16 @@ class _InvisionCommunityRebuildContent
|
||||
/**
|
||||
* Update local embeds for new names, IDs
|
||||
*
|
||||
* @param \DOMElement $element DOM element
|
||||
* @param DOMElement $element DOM element
|
||||
* @return void
|
||||
*/
|
||||
public function updateEmbed( \DOMElement $element )
|
||||
public function updateEmbed( DOMElement $element )
|
||||
{
|
||||
try
|
||||
{
|
||||
$url = \IPS\Http\Url::createFromString( str_replace( '<___base_url___>', rtrim( \IPS\Settings::i()->base_url, '/' ), $element->getAttribute( 'src' ) ) );
|
||||
$url = Url::createFromString( str_replace( '<___base_url___>', rtrim( Settings::i()->base_url, '/' ), $element->getAttribute( 'src' ) ) );
|
||||
|
||||
if( !\in_array( $url->hiddenQueryString['app'], array_keys( $this->embedLocations ) ) )
|
||||
if( !in_array( $url->hiddenQueryString['app'], array_keys( $this->embedLocations ) ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -282,7 +300,7 @@ class _InvisionCommunityRebuildContent
|
||||
$url = $url->setQueryString( 'comment', $this->app->getLink( $url->queryString['comment'], $this->embedLocations[ $url->hiddenQueryString['app'] ]['comment'] ) );
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$url = $url->stripQueryString( 'comment' );
|
||||
}
|
||||
@@ -294,23 +312,23 @@ class _InvisionCommunityRebuildContent
|
||||
$url = $url->setQueryString( 'embedComment', $this->app->getLink( $url->queryString['embedComment'], $this->embedLocations[ $url->hiddenQueryString['app'] ]['comment'] ) );
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$url = $url->stripQueryString( 'embedComment' );
|
||||
}
|
||||
|
||||
$element->setAttribute( 'src', str_replace( \IPS\Settings::i()->base_url, '<___base_url___>/', (string) $url->correctFriendlyUrl() ) );
|
||||
$element->setAttribute( 'src', str_replace( Settings::i()->base_url, '<___base_url___>/', (string) $url->correctFriendlyUrl() ) );
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
catch( Exception $e ) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update quotes for new names, IDs
|
||||
*
|
||||
* @param \DOMElement $element DOM element
|
||||
* @param DOMElement $element DOM element
|
||||
* @return void
|
||||
*/
|
||||
public function updateQuote( \DOMElement $element )
|
||||
public function updateQuote( DOMElement $element )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -318,7 +336,7 @@ class _InvisionCommunityRebuildContent
|
||||
$newMemberId = $this->app->getLink( $element->getAttribute( 'data-ipsquote-userid' ), 'core_members' );
|
||||
|
||||
/* Get new member */
|
||||
$member = \IPS\Member::load( $newMemberId );
|
||||
$member = Member::load( $newMemberId );
|
||||
|
||||
/* Get old username */
|
||||
$oldUsername = $element->getAttribute( 'data-ipsquote-username' );
|
||||
@@ -335,12 +353,12 @@ class _InvisionCommunityRebuildContent
|
||||
/* find the citation to update the username */
|
||||
foreach ( $element->childNodes as $child )
|
||||
{
|
||||
if ( $child instanceof \DOMElement and $child->getAttribute('class') == 'ipsQuote_citation' )
|
||||
if ( $child instanceof DOMElement and $child->getAttribute('class') == 'ipsQuote_citation' )
|
||||
{
|
||||
$child->nodeValue = str_replace( $oldUsername, $member->name, $child->nodeValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
catch( Exception $e ) {}
|
||||
}
|
||||
}
|
||||
@@ -12,33 +12,50 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Data\Store;
|
||||
use IPS\IPS;
|
||||
use IPS\Log;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Text\LegacyParser;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
use function get_class;
|
||||
use function is_array;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildContent
|
||||
class RebuildContent
|
||||
{
|
||||
/**
|
||||
* @brief Number of content items to rebuild per cycle
|
||||
*/
|
||||
public $rebuild = \IPS\REBUILD_SLOW;
|
||||
public $rebuild = REBUILD_SLOW;
|
||||
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$classname = $data['class'];
|
||||
|
||||
\IPS\Log::debug( "Getting preQueueData for " . $classname, 'rebuildPosts' );
|
||||
Log::debug( "Getting preQueueData for " . $classname, 'rebuildPosts' );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -48,12 +65,12 @@ class _RebuildContent
|
||||
/* We're going to use the < operator, so we need to ensure the most recent item is rebuilt */
|
||||
$data['runPid'] = $data['count'] + 1;
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
catch( Exception $ex )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
\IPS\Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'rebuildPosts' );
|
||||
Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'rebuildPosts' );
|
||||
|
||||
if( $data['count'] == 0 )
|
||||
{
|
||||
@@ -73,11 +90,11 @@ class _RebuildContent
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
$classname = $data['class'];
|
||||
$exploded = explode( '\\', $classname );
|
||||
if ( !class_exists( $classname ) or !\IPS\Application::appIsEnabled( $exploded[1] ) )
|
||||
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
@@ -91,20 +108,20 @@ class _RebuildContent
|
||||
/* Intentionally no try/catch as it means app doesn't exist */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
|
||||
$softwareClass = $app->getSource( FALSE, FALSE );
|
||||
|
||||
\IPS\Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'rebuildPosts' );
|
||||
Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'rebuildPosts' );
|
||||
|
||||
$where = ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? ( \is_array( $classname::commentWhere() ) ? array( $classname::commentWhere() ) : array() ) : array();
|
||||
$where = ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? ( is_array( $classname::commentWhere() ) ? array( $classname::commentWhere() ) : array() ) : array();
|
||||
$select = $classname::db()->select( '*', $classname::$databaseTable, array_merge( $where, array( array( $classname::$databasePrefix . $classname::$databaseColumnId . ' < ?', $data['runPid'] ) ) ), $classname::$databasePrefix . $classname::$databaseColumnId . ' DESC', array( 0, $this->rebuild ) );
|
||||
$iterator = new \IPS\Patterns\ActiveRecordIterator( $select, $classname );
|
||||
$iterator = new ActiveRecordIterator( $select, $classname );
|
||||
$last = NULL;
|
||||
|
||||
foreach( $iterator as $item )
|
||||
@@ -117,66 +134,42 @@ class _RebuildContent
|
||||
/* Just checking, we don't actually need anything */
|
||||
$app->checkLink( $item->$idColumn, $data['link'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$last = $item->$idColumn;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Did the rebuild previously time out on this? If so we need to skip it and move along */
|
||||
if( isset( \IPS\Data\Store::i()->currentRebuild ) )
|
||||
if( isset( Store::i()->currentRebuild ) )
|
||||
{
|
||||
/* If the last rebuild cycle timed out, currentRebuild might be set and we might have already rebuilt this post (the post that caused the rebuild to fail might come after this (but before in chronological order).
|
||||
If that is the case, we should skip rebuilding this post again. */
|
||||
if( \is_array( \IPS\Data\Store::i()->currentRebuild ) AND \IPS\Data\Store::i()->currentRebuild[0] == $classname AND \IPS\Data\Store::i()->currentRebuild[1] < $item->$idColumn )
|
||||
if( is_array( Store::i()->currentRebuild ) AND Store::i()->currentRebuild[0] == $classname AND Store::i()->currentRebuild[1] < $item->$idColumn )
|
||||
{
|
||||
$last = $item->$idColumn;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If the last rebuild cycle failed and we have just retrieved the post we last attempted to rebuild, skip it and move along */
|
||||
if( \is_array( \IPS\Data\Store::i()->currentRebuild ) AND \IPS\Data\Store::i()->currentRebuild[0] == $classname AND \IPS\Data\Store::i()->currentRebuild[1] == $item->$idColumn )
|
||||
if( is_array( Store::i()->currentRebuild ) AND Store::i()->currentRebuild[0] == $classname AND Store::i()->currentRebuild[1] == $item->$idColumn )
|
||||
{
|
||||
unset( \IPS\Data\Store::i()->currentRebuild );
|
||||
unset( Store::i()->currentRebuild );
|
||||
$last = $item->$idColumn;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$member = \IPS\Member::load( $item->mapped('author') );
|
||||
$extensions = \IPS\Application::load( $classname::$application )->extensions( 'core', 'EditorLocations' );
|
||||
$member = Member::load( $item->mapped('author') );
|
||||
|
||||
if( isset( $classname::$itemClass ) )
|
||||
{
|
||||
$itemClass = $classname::$itemClass;
|
||||
$module = mb_ucfirst( $itemClass::$module );
|
||||
$module = IPS::mb_ucfirst( $itemClass::$module );
|
||||
}
|
||||
else
|
||||
{
|
||||
$module = mb_ucfirst( $classname::$module );
|
||||
}
|
||||
|
||||
$extension = NULL;
|
||||
|
||||
if ( isset( $extensions[ $module ] ) )
|
||||
{
|
||||
$extension = $extensions[ $module ];
|
||||
}
|
||||
|
||||
$canUseHtml = (bool) $member->group['g_dohtml'];
|
||||
|
||||
if ( $extension )
|
||||
{
|
||||
$extensionCanUseHtml = $extension->canUseHtml( $member );
|
||||
if ( $extensionCanUseHtml !== NULL )
|
||||
{
|
||||
$canUseHtml = $extensionCanUseHtml;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $canUseHtml )
|
||||
{
|
||||
$canUseHtml = $item->htmlParsingEnforced();
|
||||
$module = IPS::mb_ucfirst( $classname::$module );
|
||||
}
|
||||
|
||||
$contentColumn = $classname::$databaseColumnMap['content'];
|
||||
@@ -191,7 +184,7 @@ class _RebuildContent
|
||||
{
|
||||
$id1 = $item->item()->$itemIdColumn;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
/* Post is orphaned and can be skipped */
|
||||
$last = $item->$idColumn;
|
||||
@@ -209,20 +202,20 @@ class _RebuildContent
|
||||
|
||||
/* Before we start trying to rebuild, set a flag to note what we are trying to rebuild. If it times out, we can check
|
||||
this on the next load and skip the problematic content */
|
||||
\IPS\Data\Store::i()->currentRebuild = array( $classname, $item->$idColumn );
|
||||
Store::i()->currentRebuild = array( $classname, $item->$idColumn );
|
||||
|
||||
try
|
||||
{
|
||||
/* Pass off to software class */
|
||||
if ( $softwareClass::$contentFixed === FALSE )
|
||||
{
|
||||
$item->$contentColumn = $softwareClass::fixPostData( $item->$contentColumn );
|
||||
$item->$contentColumn = $softwareClass::fixPostData( $item->$contentColumn, $data['class'], $item->$idColumn );
|
||||
}
|
||||
|
||||
/* Then pass off to legacy parser to bring up to 4.x */
|
||||
$item->$contentColumn = \IPS\Text\LegacyParser::parseStatic( $item->$contentColumn, $member, $canUseHtml, $classname::$application . '_' . mb_ucfirst( $module ), $id1, $id2, NULL, isset( $classname::$itemClass ) ? $classname::$itemClass : \get_class( $item ) );
|
||||
$item->$contentColumn = LegacyParser::parseStatic( $item->$contentColumn, $member, false, $classname::$application . '_' . IPS::mb_ucfirst( $module ), $id1, $id2, NULL, isset( $classname::$itemClass ) ? $classname::$itemClass : get_class( $item ) );
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
if( $e->getcode() == 103014 )
|
||||
{
|
||||
@@ -241,7 +234,7 @@ class _RebuildContent
|
||||
$data['indexed']++;
|
||||
|
||||
/* Now we will reset the rebuild flag we previously set since it rebuilt and saved successfully */
|
||||
unset( \IPS\Data\Store::i()->currentRebuild );
|
||||
unset( Store::i()->currentRebuild );
|
||||
}
|
||||
|
||||
/* Store the runPid for the next iteration of this Queue task. This allows the progress bar to show correctly. */
|
||||
@@ -262,17 +255,17 @@ class _RebuildContent
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
* @throws \OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
$class = $data['class'];
|
||||
$exploded = explode( '\\', $class );
|
||||
if ( !class_exists( $class ) or !\IPS\Application::appIsEnabled( $exploded[1] ) )
|
||||
if ( !class_exists( $class ) or !Application::appIsEnabled( $exploded[1] ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack('rebuilding_stuff', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $class::$title . '_pl', FALSE, array( 'strtolower' => TRUE ) ) ) ) ), 'complete' => $data['realCount'] ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack('rebuilding_stuff', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl', FALSE, array( 'strtolower' => TRUE ) ) ) ) ), 'complete' => $data['realCount'] ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,30 +12,41 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\Db;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use UnderflowException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildConversationFirstIds
|
||||
class RebuildConversationFirstIds
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
try
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(mt_id)', 'core_message_topics' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(mt_id)', 'core_message_topics' )->first();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
@@ -56,21 +67,21 @@ class _RebuildConversationFirstIds
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int New offset
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
$last = NULL;
|
||||
|
||||
$topicIdsToReset = array();
|
||||
$firstPostIds = array();
|
||||
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_message_topics', array( "mt_id>?", $offset ), "mt_id ASC", array( 0, \IPS\REBUILD_SLOW ) ), 'IPS\core\Messenger\Conversation' ) AS $conversation )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'core_message_topics', array( "mt_id>?", $offset ), "mt_id ASC", array( 0, REBUILD_SLOW ) ), 'IPS\core\Messenger\Conversation' ) AS $conversation )
|
||||
{
|
||||
try
|
||||
{
|
||||
/* Set first post */
|
||||
$conversation->first_msg_id = \IPS\Db::i()->select( 'msg_id', 'core_message_posts', array( 'msg_topic_id=?', $conversation->id ), 'msg_date ASC', 1 )->first();
|
||||
$conversation->first_msg_id = Db::i()->select( 'msg_id', 'core_message_posts', array( 'msg_topic_id=?', $conversation->id ), 'msg_date ASC', 1 )->first();
|
||||
$conversation->save();
|
||||
|
||||
/* Reset new_topic value for topic */
|
||||
@@ -78,26 +89,26 @@ class _RebuildConversationFirstIds
|
||||
$firstPostIds[] = $conversation->first_msg_id;
|
||||
}
|
||||
/* Underflow exception may occur if the topic doesn't have any posts for an unknown reason */
|
||||
catch( \UnderflowException $e ) {}
|
||||
catch( UnderflowException $e ) {}
|
||||
|
||||
$last = $conversation->id;
|
||||
$data['completed']++;
|
||||
}
|
||||
|
||||
/* Reset flags as needed */
|
||||
if( \count( $topicIdsToReset ) )
|
||||
if( count( $topicIdsToReset ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_is_first_post' => 0 ), array( 'msg_topic_id IN(' . implode( ',', $topicIdsToReset ) . ')' ) );
|
||||
Db::i()->update( 'core_message_posts', array( 'msg_is_first_post' => 0 ), array( 'msg_topic_id IN(' . implode( ',', $topicIdsToReset ) . ')' ) );
|
||||
}
|
||||
|
||||
if( \count( $firstPostIds ) )
|
||||
if( count( $firstPostIds ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_is_first_post' => 1 ), array( 'msg_id IN(' . implode( ',', $firstPostIds ) . ')' ) );
|
||||
Db::i()->update( 'core_message_posts', array( 'msg_is_first_post' => 1 ), array( 'msg_id IN(' . implode( ',', $firstPostIds ) . ')' ) );
|
||||
}
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -110,8 +121,8 @@ class _RebuildConversationFirstIds
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack('queue_rebuilding_conversation_first_id'), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack('queue_rebuilding_conversation_first_id'), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,30 +12,43 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\Db;
|
||||
use IPS\forums\Topic\ArchivedPost;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use UnderflowException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildFirstPostIds
|
||||
class RebuildFirstPostIds
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
try
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(tid)', 'forums_topics' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(tid)', 'forums_topics' )->first();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
@@ -56,13 +69,13 @@ class _RebuildFirstPostIds
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int New offset
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
if ( !class_exists( 'IPS\forums\Topic' ) OR !\IPS\Application::appisEnabled( 'forums' ) )
|
||||
if ( !class_exists( 'IPS\forums\Topic' ) OR !Application::appisEnabled( 'forums' ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$last = NULL;
|
||||
@@ -72,14 +85,14 @@ class _RebuildFirstPostIds
|
||||
$firstPostIds = array();
|
||||
$firstPostArchivedIds = array();
|
||||
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'forums_topics', array( "tid>?", $offset ), "tid ASC", array( 0, \IPS\REBUILD_SLOW ) ), 'IPS\forums\Topic' ) AS $topic )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'forums_topics', array( "tid>?", $offset ), "tid ASC", array( 0, REBUILD_SLOW ) ), 'IPS\forums\Topic' ) AS $topic )
|
||||
{
|
||||
if ( $topic->isArchived() == FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
/* Set first post */
|
||||
$topic->topic_firstpost = \IPS\Db::i()->select( 'pid', 'forums_posts', array( 'topic_id=?', $topic->tid ), 'post_date ASC', 1 )->first();
|
||||
$topic->topic_firstpost = Db::i()->select( 'pid', 'forums_posts', array( 'topic_id=?', $topic->tid ), 'post_date ASC', 1 )->first();
|
||||
$topic->save();
|
||||
|
||||
/* Reset new_topic value for topic */
|
||||
@@ -87,14 +100,14 @@ class _RebuildFirstPostIds
|
||||
$firstPostIds[] = $topic->topic_firstpost;
|
||||
}
|
||||
/* Underflow exception may occur if the topic doesn't have any posts for an unknown reason */
|
||||
catch( \UnderflowException $e ) {}
|
||||
catch( UnderflowException $e ) {}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
/* Set first post */
|
||||
$topic->topic_firstpost = \IPS\forums\Topic\ArchivedPost::db()->select( 'archive_id', 'forums_archive_posts', array( "archive_topic_id=?", $topic->tid ), "archive_content_date ASC", 1 )->first();
|
||||
$topic->topic_firstpost = ArchivedPost::db()->select( 'archive_id', 'forums_archive_posts', array( "archive_topic_id=?", $topic->tid ), "archive_content_date ASC", 1 )->first();
|
||||
$topic->save();
|
||||
|
||||
/* Reset new_topic value for topic */
|
||||
@@ -102,7 +115,7 @@ class _RebuildFirstPostIds
|
||||
$firstPostArchivedIds[] = $topic->topic_firstpost;
|
||||
}
|
||||
/* Underflow exception may occur if the topic doesn't have any posts for an unknown reason */
|
||||
catch( \UnderflowException $e ) {}
|
||||
catch( UnderflowException $e ) {}
|
||||
}
|
||||
|
||||
$last = $topic->tid;
|
||||
@@ -110,29 +123,29 @@ class _RebuildFirstPostIds
|
||||
}
|
||||
|
||||
/* Reset flags as needed */
|
||||
if( \count( $topicIdsToReset ) )
|
||||
if( count( $topicIdsToReset ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'new_topic' => 0 ), array( 'topic_id IN(' . implode( ',', $topicIdsToReset ) . ')' ) );
|
||||
Db::i()->update( 'forums_posts', array( 'new_topic' => 0 ), array( 'topic_id IN(' . implode( ',', $topicIdsToReset ) . ')' ) );
|
||||
}
|
||||
|
||||
if( \count( $firstPostIds ) )
|
||||
if( count( $firstPostIds ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'new_topic' => 1 ), array( 'pid IN(' . implode( ',', $firstPostIds ) . ')' ) );
|
||||
Db::i()->update( 'forums_posts', array( 'new_topic' => 1 ), array( 'pid IN(' . implode( ',', $firstPostIds ) . ')' ) );
|
||||
}
|
||||
|
||||
if( \count( $archivedTopicIdsToReset ) )
|
||||
if( count( $archivedTopicIdsToReset ) )
|
||||
{
|
||||
\IPS\forums\Topic\ArchivedPost::db()->update( 'forums_archive_posts', array( 'archive_is_first' => 0 ), array( 'archive_topic_id IN(' . implode( ',', $archivedTopicIdsToReset ) . ')' ) );
|
||||
ArchivedPost::db()->update( 'forums_archive_posts', array( 'archive_is_first' => 0 ), array( 'archive_topic_id IN(' . implode( ',', $archivedTopicIdsToReset ) . ')' ) );
|
||||
}
|
||||
|
||||
if( \count( $firstPostArchivedIds ) )
|
||||
if( count( $firstPostArchivedIds ) )
|
||||
{
|
||||
\IPS\forums\Topic\ArchivedPost::db()->update( 'forums_archive_posts', array( 'archive_is_first' => 1 ), array( 'archive_id IN(' . implode( ',', $firstPostArchivedIds ) . ')' ) );
|
||||
ArchivedPost::db()->update( 'forums_archive_posts', array( 'archive_is_first' => 1 ), array( 'archive_id IN(' . implode( ',', $firstPostArchivedIds ) . ')' ) );
|
||||
}
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -145,8 +158,8 @@ class _RebuildFirstPostIds
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack('queue_rebuilding_new_topic_flag'), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack('queue_rebuilding_new_topic_flag'), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,30 +12,43 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Db;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildGalleryImages
|
||||
class RebuildGalleryImages
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
try
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(image_id)', 'gallery_images' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(image_id)', 'gallery_images' )->first();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
@@ -56,28 +69,28 @@ class _RebuildGalleryImages
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
if ( !class_exists( 'IPS\gallery\Image' ) OR !\IPS\Application::appIsEnabled( 'gallery' ) )
|
||||
if ( !class_exists( 'IPS\gallery\Image' ) OR !Application::appIsEnabled( 'gallery' ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
/* Intentionally no try/catch as it means app doesn't exist */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$last = NULL;
|
||||
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'gallery_images', array( "image_id>?", $offset ), 'image_id ASC', array( 0, \IPS\REBUILD_INTENSE ) ), 'IPS\gallery\Image' ) AS $image )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'gallery_images', array( "image_id>?", $offset ), 'image_id ASC', array( 0, REBUILD_SLOW ) ), 'IPS\gallery\Image' ) AS $image )
|
||||
{
|
||||
$data['completed']++;
|
||||
|
||||
@@ -98,12 +111,12 @@ class _RebuildGalleryImages
|
||||
$image->buildThumbnails();
|
||||
$image->save();
|
||||
}
|
||||
catch( \DomainException $e )
|
||||
catch( DomainException $e )
|
||||
{
|
||||
$image->delete();
|
||||
}
|
||||
/* File fails the image type test */
|
||||
catch( \InvalidArgumentException $e )
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
$image->delete();
|
||||
}
|
||||
@@ -113,7 +126,7 @@ class _RebuildGalleryImages
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -126,8 +139,8 @@ class _RebuildGalleryImages
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaning task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_rebuilding_gallery_images' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_rebuilding_gallery_images' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,34 +12,42 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Member;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildNonContent
|
||||
class RebuildNonContent
|
||||
{
|
||||
/**
|
||||
* @brief Number of content items to rebuild per cycle
|
||||
*/
|
||||
public $rebuild = \IPS\REBUILD_SLOW;
|
||||
public $rebuild = REBUILD_SLOW;
|
||||
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$data['count'] = 0;
|
||||
$_extensionData = explode( '_', $data['extension'] );
|
||||
|
||||
foreach( \IPS\Application::load( $_extensionData[0] )->extensions( 'core', 'EditorLocations' ) as $_key => $extension )
|
||||
foreach( Application::load( $_extensionData[0] )->extensions( 'core', 'EditorLocations' ) as $_key => $extension )
|
||||
{
|
||||
if( $_key != $_extensionData[1] )
|
||||
{
|
||||
@@ -63,11 +71,11 @@ class _RebuildNonContent
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( $data, $offset )
|
||||
public function run( array &$data, int $offset ): int
|
||||
{
|
||||
foreach( \IPS\Application::allExtensions( 'core', 'EditorLocations', FALSE, NULL, NULL, TRUE ) as $_key => $extension )
|
||||
foreach( Application::allExtensions( 'core', 'EditorLocations', FALSE, NULL, NULL, TRUE ) as $_key => $extension )
|
||||
{
|
||||
if( $_key != $data['extension'] )
|
||||
{
|
||||
@@ -76,11 +84,11 @@ class _RebuildNonContent
|
||||
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
if( method_exists( $extension, 'rebuildContent' ) )
|
||||
@@ -99,7 +107,7 @@ class _RebuildNonContent
|
||||
}
|
||||
|
||||
/* Rebuild is complete */
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,8 +117,8 @@ class _RebuildNonContent
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaning task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'rebuilding_noncontent_posts', FALSE, array( 'sprintf' => \IPS\Member::loggedIn()->language()->addToStack( 'editor__' . $data['extension'] ) ) ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $offset, 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'rebuilding_noncontent_posts', FALSE, array( 'sprintf' => Member::loggedIn()->language()->addToStack( 'editor__' . $data['extension'] ) ) ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $offset, 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,30 +12,42 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\convert\App;
|
||||
use IPS\Db;
|
||||
use IPS\File;
|
||||
use IPS\Member;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use UnderflowException;
|
||||
use function defined;
|
||||
use const IPS\PHOTO_THUMBNAIL_SIZE;
|
||||
use const IPS\REBUILD_SLOW;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildProfilePhotos
|
||||
class RebuildProfilePhotos
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
try
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(member_id)', 'core_members', [ 'pp_photo_type=?', 'custom' ] )->first();
|
||||
$data['count'] = Db::i()->select( 'count(member_id)', 'core_members', [ 'pp_photo_type=?', 'custom' ] )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
@@ -56,23 +68,23 @@ class _RebuildProfilePhotos
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
/* Intentionally no try/catch as it means app doesn't exist */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$last = NULL;
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_members', [ "member_id>? AND pp_photo_type=?", $offset, 'custom' ], 'member_id ASC', [ 0, \IPS\REBUILD_SLOW ] ) AS $member )
|
||||
foreach( Db::i()->select( '*', 'core_members', [ "member_id>? AND pp_photo_type=?", $offset, 'custom' ], 'member_id ASC', [ 0, REBUILD_SLOW ] ) AS $member )
|
||||
{
|
||||
$data['completed']++;
|
||||
|
||||
@@ -90,18 +102,18 @@ class _RebuildProfilePhotos
|
||||
|
||||
try
|
||||
{
|
||||
$photo = \IPS\File::get( 'core_Profile', $member['pp_main_photo'] );
|
||||
$thumbnail = $photo->thumbnail( 'core_Profile', \IPS\PHOTO_THUMBNAIL_SIZE, \IPS\PHOTO_THUMBNAIL_SIZE, TRUE );
|
||||
\IPS\Db::i()->update( 'core_members', [ 'pp_thumb_photo' => (string) $thumbnail ], [ 'member_id=?', $member['member_id'] ] );
|
||||
$photo = File::get( 'core_Profile', $member['pp_main_photo'] );
|
||||
$thumbnail = $photo->thumbnail( 'core_Profile', PHOTO_THUMBNAIL_SIZE, PHOTO_THUMBNAIL_SIZE, TRUE );
|
||||
Db::i()->update( 'core_members', [ 'pp_thumb_photo' => (string) $thumbnail ], [ 'member_id=?', $member['member_id'] ] );
|
||||
}
|
||||
catch( \Exception $e ) { }
|
||||
catch( Exception $e ) { }
|
||||
|
||||
$last = $member['member_id'];
|
||||
}
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -114,8 +126,8 @@ class _RebuildProfilePhotos
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaning task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_rebuilding_profile_photos' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_rebuilding_profile_photos' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,39 +12,52 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Db;
|
||||
use IPS\IPS;
|
||||
use IPS\Log;
|
||||
use IPS\Member;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use const IPS\REBUILD_QUICK;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RebuildTagCache
|
||||
class RebuildTagCache
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$classname = $data['class'];
|
||||
|
||||
\IPS\Log::debug( "Getting preQueueData for " . $classname, 'rebuildTagCache' );
|
||||
Log::debug( "Getting preQueueData for " . $classname, 'rebuildTagCache' );
|
||||
|
||||
try
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'COUNT(DISTINCT tag_aai_lookup)', 'core_tags', array( 'tag_meta_app=? AND tag_meta_area=?', $classname::$application, $classname::$module ) )->first();
|
||||
$data['count'] = Db::i()->select( 'COUNT(DISTINCT tag_aai_lookup)', 'core_tags', array( 'tag_meta_app=? AND tag_meta_area=?', $classname::$application, $classname::$module ) )->first();
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
catch( Exception $ex )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
\IPS\Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'rebuildTagCache' );
|
||||
Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'rebuildTagCache' );
|
||||
|
||||
if( $data['count'] == 0 )
|
||||
{
|
||||
@@ -65,11 +78,11 @@ class _RebuildTagCache
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
$classname = $data['class'];
|
||||
$exploded = explode( '\\', $classname );
|
||||
if ( !class_exists( $classname ) or !\IPS\Application::appIsEnabled( $exploded[1] ) OR !\in_array( 'IPS\Content\Tags', class_implements( $classname ) ) )
|
||||
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) OR !in_array( 'IPS\Content\Taggable', class_implements( $classname ) ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
@@ -77,16 +90,16 @@ class _RebuildTagCache
|
||||
/* Intentionally no try/catch as it means app doesn't exist */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
}
|
||||
|
||||
\IPS\Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'rebuildTagCache' );
|
||||
Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'rebuildTagCache' );
|
||||
|
||||
$select = \IPS\Db::i()->select( '*', 'core_tags', array( 'tag_id>? AND tag_meta_app=? AND tag_meta_area=?', $data['currentId'], $classname::$application, $classname::$module ), 'tag_id ASC', array( 0, \IPS\REBUILD_QUICK ), NULL, NULL, \IPS\Db::SELECT_DISTINCT );
|
||||
$select = Db::i()->select( '*', 'core_tags', array( 'tag_id>? AND tag_meta_app=? AND tag_meta_area=?', $data['currentId'], $classname::$application, $classname::$module ), 'tag_id ASC', array( 0, REBUILD_QUICK ), NULL, NULL, Db::SELECT_DISTINCT );
|
||||
$last = NULL;
|
||||
|
||||
foreach( $select as $outerTag )
|
||||
@@ -96,7 +109,7 @@ class _RebuildTagCache
|
||||
$last = $outerTag['tag_id'];
|
||||
$prefix = NULL;
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_tags', array( 'tag_aai_lookup=?', $outerTag['tag_aai_lookup'] ) ) as $tag )
|
||||
foreach( Db::i()->select( '*', 'core_tags', array( 'tag_aai_lookup=?', $outerTag['tag_aai_lookup'] ) ) as $tag )
|
||||
{
|
||||
if( $tag['tag_prefix'] )
|
||||
{
|
||||
@@ -119,7 +132,7 @@ class _RebuildTagCache
|
||||
/* Just checking, we don't actually need anything */
|
||||
$app->checkLink( $outerTag['tag_meta_id'], $data['link'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -129,12 +142,12 @@ class _RebuildTagCache
|
||||
{
|
||||
$item = $classname::load( $outerTag['tag_meta_id'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
\IPS\Db::i()->insert( 'core_tags_cache', array(
|
||||
Db::i()->insert( 'core_tags_cache', array(
|
||||
'tag_cache_key' => $outerTag['tag_aai_lookup'],
|
||||
'tag_cache_text' => json_encode( array( 'tags' => $tags, 'prefix' => $prefix ) ),
|
||||
'tag_cache_date' => time()
|
||||
@@ -148,11 +161,11 @@ class _RebuildTagCache
|
||||
|
||||
if ( isset( $containerClass::$permissionMap['read'] ) )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_tags_perms', array(
|
||||
Db::i()->insert( 'core_tags_perms', array(
|
||||
'tag_perm_aai_lookup' => $outerTag['tag_aai_lookup'],
|
||||
'tag_perm_aap_lookup' => $outerTag['tag_aap_lookup'],
|
||||
'tag_perm_text' => $permissions[ 'perm_' . $containerClass::$permissionMap['read'] ] ?? '',
|
||||
'tag_perm_visible' => ( $item->hidden() OR $item->isFutureDate() ) ? 0 : 1,
|
||||
'tag_perm_visible' => ( $item->hidden() OR ( IPS::classUsesTrait( $item, 'IPS\Content\FuturePublishing' ) AND $item->isFutureDate() ) ) ? 0 : 1,
|
||||
), TRUE );
|
||||
}
|
||||
}
|
||||
@@ -178,17 +191,17 @@ class _RebuildTagCache
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
* @throws \OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
$class = $data['class'];
|
||||
$exploded = explode( '\\', $class );
|
||||
if ( !class_exists( $class ) or !\IPS\Application::appIsEnabled( $exploded[1] ) )
|
||||
if ( !class_exists( $class ) or !Application::appIsEnabled( $exploded[1] ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_rebuilding_tag_cache', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $class::$title . '_pl', FALSE, array( 'strtolower' => TRUE ) ) ) ) ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['indexed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_rebuilding_tag_cache', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl', FALSE, array( 'strtolower' => TRUE ) ) ) ) ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['indexed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,26 +12,35 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Db;
|
||||
use IPS\Member;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_NORMAL;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RecountAnswerRatings
|
||||
class RecountAnswerRatings
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(pid)', 'forums_posts' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(pid)', 'forums_posts' )->first();
|
||||
|
||||
if( $data['count'] == 0 )
|
||||
{
|
||||
@@ -49,13 +58,13 @@ class _RecountAnswerRatings
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int New offset
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
if ( !class_exists( 'IPS\forums\Topic\Post' ) OR !\IPS\Application::appisEnabled( 'forums' ) )
|
||||
if ( !class_exists( 'IPS\forums\Topic\Post' ) OR !Application::appisEnabled( 'forums' ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$last = NULL;
|
||||
@@ -63,15 +72,15 @@ class _RecountAnswerRatings
|
||||
/* If the app doesn't exist, stop now */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
/* Loop over distinct post IDs in forums_answer_ratings - while using the DISTINCT flag can be slower, there generally aren't many of these */
|
||||
foreach( \IPS\Db::i()->select( 'post', 'forums_answer_ratings', array( "post>?", $offset ), "post ASC", array( 0, \IPS\REBUILD_NORMAL ), NULL, NULL, \IPS\Db::SELECT_DISTINCT ) AS $pid )
|
||||
foreach( Db::i()->select( 'post', 'forums_answer_ratings', array( "post>?", $offset ), "post ASC", array( 0, REBUILD_NORMAL ), NULL, NULL, Db::SELECT_DISTINCT ) AS $pid )
|
||||
{
|
||||
$last = $pid;
|
||||
$data['completed']++;
|
||||
@@ -88,14 +97,14 @@ class _RecountAnswerRatings
|
||||
}
|
||||
|
||||
/* Rebuild count */
|
||||
\IPS\Db::i()->update( 'forums_posts', array(
|
||||
'post_field_int' => (int) \IPS\Db::i()->select( 'SUM(rating)', 'forums_answer_ratings', array( 'post=?', $pid ) )->first()
|
||||
Db::i()->update( 'forums_posts', array(
|
||||
'post_field_int' => (int) Db::i()->select( 'SUM(rating)', 'forums_answer_ratings', array( 'post=?', $pid ) )->first()
|
||||
), array( 'pid=?', $pid ) );
|
||||
}
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -108,8 +117,8 @@ class _RecountAnswerRatings
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_recounting_answer_ratings' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_recounting_answer_ratings' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,26 +12,34 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_NORMAL;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RecountClubMembers
|
||||
class RecountClubMembers
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(id)', 'core_clubs' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(id)', 'core_clubs' )->first();
|
||||
|
||||
if( $data['count'] == 0 )
|
||||
{
|
||||
@@ -49,13 +57,13 @@ class _RecountClubMembers
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int New offset
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
$last = NULL;
|
||||
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_clubs', array( "id>?", $offset ), "id ASC", array( 0, \IPS\REBUILD_NORMAL ) ), 'IPS\Member\Club' ) AS $club )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'core_clubs', array( "id>?", $offset ), "id ASC", array( 0, REBUILD_NORMAL ) ), 'IPS\Member\Club' ) AS $club )
|
||||
{
|
||||
$club->recountMembers();
|
||||
$last = $club->id;
|
||||
@@ -64,7 +72,7 @@ class _RecountClubMembers
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -77,8 +85,8 @@ class _RecountClubMembers
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_recounting_club_members' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_recounting_club_members' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -12,26 +12,35 @@
|
||||
namespace IPS\convert\extensions\core\Queue;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Db;
|
||||
use IPS\Member;
|
||||
use IPS\Task\Queue\OutOfRangeException;
|
||||
use function defined;
|
||||
use const IPS\REBUILD_NORMAL;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class _RecountQuestionRatings
|
||||
class RecountQuestionRatings
|
||||
{
|
||||
/**
|
||||
* Parse data before queuing
|
||||
*
|
||||
* @param array $data Data
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public function preQueueData( $data )
|
||||
public function preQueueData( array $data ): ?array
|
||||
{
|
||||
$data['count'] = \IPS\Db::i()->select( 'count(tid)', 'forums_topics' )->first();
|
||||
$data['count'] = Db::i()->select( 'count(tid)', 'forums_topics' )->first();
|
||||
|
||||
if( $data['count'] == 0 )
|
||||
{
|
||||
@@ -49,13 +58,13 @@ class _RecountQuestionRatings
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int New offset
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( &$data, $offset )
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
if ( !class_exists( 'IPS\forums\Topic' ) OR !\IPS\Application::appisEnabled( 'forums' ) )
|
||||
if ( !class_exists( 'IPS\forums\Topic' ) OR !Application::appisEnabled( 'forums' ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$last = NULL;
|
||||
@@ -63,15 +72,15 @@ class _RecountQuestionRatings
|
||||
/* If the app doesn't exist, stop now */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( $data['app'] );
|
||||
$app = App::load( $data['app'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
/* Loop over distinct topic IDs in forums_question_ratings - while using the DISTINCT flag can be slower, there generally aren't many of these */
|
||||
foreach( \IPS\Db::i()->select( 'topic', 'forums_question_ratings', array( "topic>?", $offset ), "topic ASC", array( 0, \IPS\REBUILD_NORMAL ), NULL, NULL, \IPS\Db::SELECT_DISTINCT ) AS $topic )
|
||||
foreach( Db::i()->select( 'topic', 'forums_question_ratings', array( "topic>?", $offset ), "topic ASC", array( 0, REBUILD_NORMAL ), NULL, NULL, Db::SELECT_DISTINCT ) AS $topic )
|
||||
{
|
||||
$last = $topic;
|
||||
$data['completed']++;
|
||||
@@ -88,14 +97,14 @@ class _RecountQuestionRatings
|
||||
}
|
||||
|
||||
/* Rebuild count */
|
||||
\IPS\Db::i()->update( 'forums_topics', array(
|
||||
'question_rating' => (int) \IPS\Db::i()->select( 'SUM(rating)', 'forums_question_ratings', array( 'topic=?', $topic ) )->first()
|
||||
Db::i()->update( 'forums_topics', array(
|
||||
'question_rating' => (int) Db::i()->select( 'SUM(rating)', 'forums_question_ratings', array( 'topic=?', $topic ) )->first()
|
||||
), array( 'tid=?', $topic ) );
|
||||
}
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return $last;
|
||||
@@ -108,8 +117,8 @@ class _RecountQuestionRatings
|
||||
* @param int $offset Offset
|
||||
* @return array Text explaining task and percentage complete
|
||||
*/
|
||||
public function getProgress( $data, $offset )
|
||||
public function getProgress( mixed $data, int $offset ): array
|
||||
{
|
||||
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack( 'queue_recounting_question_ratings' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
return array( 'text' => Member::loggedIn()->language()->addToStack( 'queue_recounting_question_ratings' ), 'complete' => $data['count'] ? ( round( 100 / $data['count'] * $data['completed'], 2 ) ) : 100 );
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,26 @@
|
||||
//<?php
|
||||
|
||||
use IPS\Db\Select;
|
||||
|
||||
class convert_hook_Db extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Build SELECT statement
|
||||
*
|
||||
* @param array|string $columns The columns (as an array) to select or an expression
|
||||
* @param array|string $table The table to select from. Either (string) table_name or (array) ( name, alias ) or \IPS\Db\Select object
|
||||
* @param array|string|NULL $where WHERE clause - see \IPS\Db::compileWhereClause() for details
|
||||
* @param string|NULL $order ORDER BY clause
|
||||
* @param array|int $limit Rows to fetch or array( offset, limit )
|
||||
* @param string|NULL|array $group Column(s) to GROUP BY
|
||||
* @param array|string|NULL $having HAVING clause (same format as WHERE clause)
|
||||
* @param int $flags Bitwise flags
|
||||
* @li \IPS\Db::SELECT_DISTINCT Will use SELECT DISTINCT
|
||||
* @li \IPS\Db::SELECT_MULTIDIMENSIONAL_JOINS Will return the result as a multidimensional array, with each joined table separately
|
||||
* @return \IPS\Db\Select
|
||||
*
|
||||
* @param array|string $columns The columns (as an array) to select or an expression
|
||||
* @param array|string $table The table to select from. Either (string) table_name or (array) ( name, alias ) or \IPS\Db\Select object
|
||||
* @param array|string|null $where WHERE clause - see \IPS\Db::compileWhereClause() for details
|
||||
* @param string|null $order ORDER BY clause
|
||||
* @param int|array|null $limit Rows to fetch or array( offset, limit )
|
||||
* @param string|NULL|array $group Column(s) to GROUP BY
|
||||
* @param array|string|null $having HAVING clause (same format as WHERE clause)
|
||||
* @param int $flags Bitwise flags
|
||||
* @return Select
|
||||
* @li \IPS\Db::SELECT_DISTINCT Will use SELECT DISTINCT
|
||||
* @li \IPS\Db::SELECT_MULTIDIMENSIONAL_JOINS Will return the result as a multidimensional array, with each joined table separately
|
||||
*/
|
||||
public function select( $columns, $table, $where=NULL, $order=NULL, $limit=NULL, $group=NULL, $having=NULL, $flags=0 )
|
||||
{
|
||||
public function select( array|string $columns, array|string|Select $table, array|string $where=NULL, string $order=NULL, int|array $limit=NULL, array|string $group=NULL, array|string $having=NULL, int $flags=0 ): Select
|
||||
{
|
||||
switch( $table )
|
||||
{
|
||||
case 'custom_bbcode':
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
@@ -21,9 +24,9 @@ class convert_hook_FrontDispatcher extends _HOOK_CLASS_
|
||||
parent::checkUrl();
|
||||
}
|
||||
/* If we are here, the URL was not valid. Let's see if we need to do anything for converted sites */
|
||||
catch( \OutOfRangeException $e )
|
||||
catch(OutOfRangeException $e )
|
||||
{
|
||||
$application = \IPS\Application::load('convert');
|
||||
$application = Application::load('convert');
|
||||
$application::checkRedirects();
|
||||
|
||||
/* If we are still here, let the exception bubble up */
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Member;
|
||||
use IPS\Settings;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
@@ -23,7 +27,7 @@ class convert_hook_LegacyParser extends _HOOK_CLASS_
|
||||
|
||||
foreach( $matches[0] as $idx => $m )
|
||||
{
|
||||
$member = \IPS\Member::load( $matches[1][ $idx ] );
|
||||
$member = Member::load( $matches[1][ $idx ] );
|
||||
|
||||
if ( $member->member_id )
|
||||
{
|
||||
@@ -35,14 +39,14 @@ class convert_hook_LegacyParser extends _HOOK_CLASS_
|
||||
}
|
||||
}
|
||||
|
||||
return str_replace( \IPS\Settings::i()->base_url, '<___base_url___>/', $result );
|
||||
return str_replace( Settings::i()->base_url, '<___base_url___>/', $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse statically
|
||||
*
|
||||
* @param string $value The value to parse
|
||||
* @param \IPS\Member|null $member The member posting. NULL will use currently logged in member.
|
||||
* @param Member|null $member The member posting. NULL will use currently logged in member.
|
||||
* @param bool $allowHtml Allow HTML
|
||||
* @param string $attachClass Key to use for attachments
|
||||
* @param int $id1 ID1 to use for attachments
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ abstract class convert_hook_LoginHandler extends _HOOK_CLASS_
|
||||
/**
|
||||
* Get all handler classes
|
||||
*/
|
||||
public static function handlerClasses()
|
||||
public static function handlerClasses(): array
|
||||
{
|
||||
$handlers = parent::handlerClasses();
|
||||
$handlers[] = 'IPS\convert\Login';
|
||||
|
||||
@@ -12,21 +12,51 @@
|
||||
namespace IPS\convert\modules\admin\manage;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Exception;
|
||||
use IPS\convert\Library;
|
||||
use IPS\convert\Software;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Checkbox;
|
||||
use IPS\Helpers\MultipleRedirect;
|
||||
use IPS\Helpers\Table\Custom;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Request;
|
||||
use IPS\Session;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use OutOfRangeException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function is_bool;
|
||||
use const IPS\CONVERTERS_DEV_UI;
|
||||
use const IPS\DEMO_MODE;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run conversion
|
||||
*/
|
||||
class _convert extends \IPS\Dispatcher\Controller
|
||||
class convert extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
@@ -37,11 +67,11 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( \IPS\CIC )
|
||||
{
|
||||
\IPS\Output::i()->error( 'module_no_permission', '2V368/2', 403, '' );
|
||||
Output::i()->error( 'module_no_permission', '2V368/2', 403, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->responsive = FALSE;
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'convert_manage' );
|
||||
Output::i()->responsive = FALSE;
|
||||
Dispatcher::i()->checkAcpPermission( 'convert_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -53,19 +83,19 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* Do we have an id? */
|
||||
if ( ! isset( \IPS\Request::i()->id ) )
|
||||
if ( ! isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V101/1' );
|
||||
Output::i()->error( 'no_conversion_app', '2V101/1' );
|
||||
}
|
||||
|
||||
/* Load the app */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '2V101/2', 404 );
|
||||
Output::i()->error( 'conversion_app_not_found', '2V101/2', 404 );
|
||||
}
|
||||
|
||||
/* Do a quick parent storage check */
|
||||
@@ -78,12 +108,12 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Are we using the legacy UI? If not, then start converting as we already have everything we need. */
|
||||
if( !\IPS\CONVERTERS_DEV_UI )
|
||||
if( !CONVERTERS_DEV_UI )
|
||||
{
|
||||
$configurationNeeded = FALSE;
|
||||
|
||||
/* If we have not yet configured the app, go there first */
|
||||
if( !\count( $app->_session['more_info'] ) )
|
||||
if( !count( $app->_session['more_info'] ) )
|
||||
{
|
||||
$configurationNeeded = TRUE;
|
||||
}
|
||||
@@ -91,7 +121,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
/* Check child apps also have more_info */
|
||||
foreach( $app->children() as $childApp )
|
||||
{
|
||||
if( !\count( $childApp->_session['more_info'] ) )
|
||||
if( !count( $childApp->_session['more_info'] ) )
|
||||
{
|
||||
$configurationNeeded = TRUE;
|
||||
break;
|
||||
@@ -101,32 +131,32 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
/* Do we need to configure? */
|
||||
if( $configurationNeeded )
|
||||
{
|
||||
$url = \IPS\Http\Url::internal( "app=convert&module=manage&controller=create&_moveToStep=convert_start_conversion_details&id=" . ( $app->parent ?: $app->app_id ) );
|
||||
$url = Url::internal( "app=convert&module=manage&controller=create&_moveToStep=convert_start_conversion_details&id=" . ( $app->parent ?: $app->app_id ) );
|
||||
}
|
||||
/* Otherwise start converting! */
|
||||
else
|
||||
{
|
||||
$url = \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=runStep&id=" . $app->app_id )->csrf();
|
||||
$url = Url::internal( "app=convert&module=manage&controller=convert&do=runStep&id=" . $app->app_id )->csrf();
|
||||
|
||||
if( isset( \IPS\Request::i()->continue ) )
|
||||
if( isset( Request::i()->continue ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'continue', \IPS\Request::i()->continue );
|
||||
$url = $url->setQueryString( 'continue', Request::i()->continue );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
Output::i()->redirect( $url );
|
||||
}
|
||||
|
||||
/* Get our details */
|
||||
$softwareClass = $app->getSource();
|
||||
$libraryClass = $softwareClass->getLibrary();
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'converting_x_to_x', FALSE, array( 'sprintf' => array( $softwareClass::softwareName(), \IPS\Application::load( $app->sw )->_title ), 'striptags' => true ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'converting_x_to_x', FALSE, array( 'sprintf' => array( $softwareClass::softwareName(), Application::load( $app->sw )->_title ), 'striptags' => true ) );
|
||||
|
||||
/* Build our table. If I can do this using only the Table helper, I'll be impressed */
|
||||
$menuRows = static::getMenuRows( $softwareClass );
|
||||
|
||||
$table = new \IPS\Helpers\Table\Custom( $menuRows, \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert" ) );
|
||||
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'table' ), 'convertMenuRow' );
|
||||
$table = new Custom( $menuRows, Url::internal( "app=convert&module=manage&controller=convert" ) );
|
||||
$table->rowsTemplate = array( Theme::i()->getTemplate( 'table' ), 'convertMenuRow' );
|
||||
$table->extra = array( 'sessionData' => $app->_session, 'appClass' => $app, 'softwareClass' => $softwareClass, 'libraryClass' => $libraryClass, 'menuRows' => $menuRows );
|
||||
$table->mainColumn = 'step_title';
|
||||
$table->showAdvancedSearch = FALSE;
|
||||
@@ -135,29 +165,29 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
$table->parsers = array(
|
||||
'step_title' => function( $row )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( $row );
|
||||
return Member::loggedIn()->language()->addToStack( $row );
|
||||
},
|
||||
);
|
||||
|
||||
\IPS\Output::i()->output = '';
|
||||
Output::i()->output = '';
|
||||
|
||||
if ( $softwareClass::canConvertSettings() !== FALSE )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'table' )->settingsMessage( $app );
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'table' )->settingsMessage( $app );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output .= $table;
|
||||
Output::i()->output .= $table;
|
||||
|
||||
if ( $libraryClass->getPostConversionInformation() != NULL )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'table' )->postConversionInformation( $libraryClass->getPostConversionInformation() );
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'table' )->postConversionInformation( $libraryClass->getPostConversionInformation() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the appropriate menu rows for the library
|
||||
*
|
||||
* @param \IPS\convert\Software $softwareClass Library class
|
||||
* @param Software $softwareClass Library class
|
||||
* @param bool $filter Filter out extra steps
|
||||
* @param bool $return Let exception bubble instead of outputting it
|
||||
* @param bool $count Count database rows
|
||||
@@ -185,7 +215,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
if( $filter === TRUE )
|
||||
{
|
||||
$menuRows = array_filter( $menuRows, function( $row ) use ( $extraSteps ) {
|
||||
if( \in_array( $row['step_method'], $extraSteps ) )
|
||||
if( in_array( $row['step_method'], $extraSteps ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -194,14 +224,14 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
});
|
||||
}
|
||||
}
|
||||
catch( \IPS\convert\Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
if( $return )
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->error( $e->getMessage(), '1V101/3', 500 );
|
||||
Output::i()->error( $e->getMessage(), '1V101/3', 500 );
|
||||
}
|
||||
|
||||
return $menuRows;
|
||||
@@ -210,7 +240,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Figure out the next steps for converting
|
||||
*
|
||||
* @param \IPS\convert\App $app Application we are converting
|
||||
* @param App $app Application we are converting
|
||||
* @return array
|
||||
*/
|
||||
protected function _getNextStep( $app )
|
||||
@@ -246,7 +276,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Loop over all applications */
|
||||
if( \count( $applicationsToCheck ) )
|
||||
if( count( $applicationsToCheck ) )
|
||||
{
|
||||
foreach( $applicationsToCheck as $appToCheck )
|
||||
{
|
||||
@@ -259,7 +289,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
$_SESSION['convertCountRows'][ $masterAppId ][ $appToCheck->app_id ] = array();
|
||||
}
|
||||
|
||||
if( !$appToCheck->parent AND $softwareClass::canConvertSettings() AND isset( $appToCheck->_session['more_info']['convertSettings'] ) AND $appToCheck->_session['more_info']['convertSettings']['convert_settings'] AND !\count( $appToCheck->_session['completed'] ) )
|
||||
if( !$appToCheck->parent AND $softwareClass::canConvertSettings() AND isset( $appToCheck->_session['more_info']['convertSettings'] ) AND $appToCheck->_session['more_info']['convertSettings']['convert_settings'] AND !count( $appToCheck->_session['completed'] ) )
|
||||
{
|
||||
$method = 'convertSettings';
|
||||
$_SESSION['convertCountRows'][ $masterAppId ][ $appToCheck->app_id ][ $method ] = 1;
|
||||
@@ -294,9 +324,9 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* We chose to convert a specific step and it's not complete */
|
||||
if( isset( \IPS\Request::i()->method ) AND $row['step_method'] == \IPS\Request::i()->method )
|
||||
if( isset( Request::i()->method ) AND $row['step_method'] == Request::i()->method )
|
||||
{
|
||||
if( !\in_array( $row['step_method'], $appToCheck->_session['completed'] ) )
|
||||
if( !in_array( $row['step_method'], $appToCheck->_session['completed'] ) )
|
||||
{
|
||||
$method = $row['step_method'];
|
||||
}
|
||||
@@ -315,19 +345,19 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* If this step has any dependencies not yet converted, skip for now */
|
||||
if( \count( array_filter( $row['dependencies'], array( $appToCheck, 'dependencies' ) ) ) )
|
||||
if( count( array_filter( $row['dependencies'], array( $appToCheck, 'dependencies' ) ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this step is already completed, also skip */
|
||||
if( \in_array( $row['step_method'], $appToCheck->_session['completed'] ) )
|
||||
if( in_array( $row['step_method'], $appToCheck->_session['completed'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we don't want this converted, also skip */
|
||||
if( empty( $appToCheck->_session['more_info'][ $row['step_method'] ][ $row['step_title'] ] ) AND !\in_array( $row['step_method'], array_keys( $softwareClass->extraMenuRows() ) ) )
|
||||
if( empty( $appToCheck->_session['more_info'][ $row['step_method'] ][ $row['step_title'] ] ) AND !in_array( $row['step_method'], array_keys( $softwareClass->extraMenuRows() ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -348,38 +378,38 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function emptyData()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
Session::i()->csrfCheck();
|
||||
|
||||
if ( ! isset( \IPS\Request::i()->id ) )
|
||||
if ( ! isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V101/4' );
|
||||
Output::i()->error( 'no_conversion_app', '2V101/4' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '2V101/5' );
|
||||
Output::i()->error( 'conversion_app_not_found', '2V101/5' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'removing_data' );
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=emptyData&id={$app->app_id}&method=" . \IPS\Request::i()->method ),
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'removing_data' );
|
||||
Output::i()->output = new MultipleRedirect( Url::internal( "app=convert&module=manage&controller=convert&do=emptyData&id={$app->app_id}&method=" . Request::i()->method ),
|
||||
function( $data ) use ( $app )
|
||||
{
|
||||
try
|
||||
{
|
||||
return $app->getSource()->getLibrary()->emptyData( $data, \IPS\Request::i()->method );
|
||||
return $app->getSource()->getLibrary()->emptyData( $data, Request::i()->method );
|
||||
}
|
||||
catch( \IPS\convert\Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=error&id={$app->app_id}" ) );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&do=error&id={$app->app_id}" ) );
|
||||
}
|
||||
},
|
||||
function() use ( $app )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&id={$app->app_id}" ) );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&id={$app->app_id}" ) );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -390,35 +420,35 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function runStep()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
Session::i()->csrfCheck();
|
||||
|
||||
/* Make sure we have our app id */
|
||||
if ( ! isset( \IPS\Request::i()->id ) )
|
||||
if ( ! isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V101/6' );
|
||||
Output::i()->error( 'no_conversion_app', '2V101/6' );
|
||||
}
|
||||
|
||||
/* Load our app */
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '2V101/7', 404 );
|
||||
Output::i()->error( 'conversion_app_not_found', '2V101/7', 404 );
|
||||
}
|
||||
|
||||
/* If we decided to truncate, we need to do so before getMoreInfo() is generated */
|
||||
if ( \IPS\CONVERTERS_DEV_UI AND isset( \IPS\Request::i()->empty_local_data ) AND \IPS\Request::i()->empty_local_data == 1 )
|
||||
if ( CONVERTERS_DEV_UI AND isset( Request::i()->empty_local_data ) AND Request::i()->empty_local_data == 1 )
|
||||
{
|
||||
$app->getSource()->getLibrary()->emptyLocalData( \IPS\Request::i()->method );
|
||||
$app->getSource()->getLibrary()->emptyLocalData( Request::i()->method );
|
||||
|
||||
/* If this step has extra steps, we need to unset the completed flag. */
|
||||
$canConvert = $app->getSource()->getLibrary()->getConvertableItems();
|
||||
$session = $app->_session;
|
||||
if ( isset( $canConvert[ \IPS\Request::i()->method ]['extra_steps'] ) )
|
||||
if ( isset( $canConvert[ Request::i()->method ]['extra_steps'] ) )
|
||||
{
|
||||
foreach( $canConvert[ \IPS\Request::i()->method ]['extra_steps'] as $next )
|
||||
foreach( $canConvert[ Request::i()->method ]['extra_steps'] as $next )
|
||||
{
|
||||
if( $key = array_search( $next, $session['completed'] ) )
|
||||
{
|
||||
@@ -429,7 +459,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Since we're emptying everything, remove the main step from the completed list
|
||||
so that 'continue' functionality can be used on the next run. */
|
||||
if( $key = array_search( \IPS\Request::i()->method, $session['completed'] ) )
|
||||
if( $key = array_search( Request::i()->method, $session['completed'] ) )
|
||||
{
|
||||
unset( $session['completed'][ $key ] );
|
||||
}
|
||||
@@ -450,7 +480,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Do we need more information? */
|
||||
if ( \IPS\CONVERTERS_DEV_UI AND ! isset( $app->_session['more_info'][ \IPS\Request::i()->method ] ) OR ( isset( \IPS\Request::i()->reconfigure ) AND \IPS\Request::i()->reconfigure == 1 ) )
|
||||
if ( CONVERTERS_DEV_UI AND ! isset( $app->_session['more_info'][ Request::i()->method ] ) OR ( isset( Request::i()->reconfigure ) AND Request::i()->reconfigure == 1 ) )
|
||||
{
|
||||
if( $this->_checkMethodConfiguration( $app ) )
|
||||
{
|
||||
@@ -459,7 +489,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Are we continuing? We need to tell the library that, but we need to use sessions to do it so it only does it on the first cycle. */
|
||||
if ( isset( \IPS\Request::i()->continue ) )
|
||||
if ( isset( Request::i()->continue ) )
|
||||
{
|
||||
/* Is it set? If not, just go ahead. */
|
||||
if ( !isset( $_SESSION['convertContinue'] ) )
|
||||
@@ -469,22 +499,22 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Generate our multiredirect URL */
|
||||
$redirectUrl = \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=runStep&id={$app->app_id}" )->csrf();
|
||||
$redirectUrl = Url::internal( "app=convert&module=manage&controller=convert&do=runStep&id={$app->app_id}" )->csrf();
|
||||
|
||||
/* Legacy URL parameters we won't need now, but will if using the developer UI */
|
||||
if( isset( \IPS\Request::i()->per_cycle ) )
|
||||
if( isset( Request::i()->per_cycle ) )
|
||||
{
|
||||
$redirectUrl = $redirectUrl->setQueryString( 'per_cycle', \IPS\Request::i()->per_cycle );
|
||||
$redirectUrl = $redirectUrl->setQueryString( 'per_cycle', Request::i()->per_cycle );
|
||||
}
|
||||
|
||||
if( isset( \IPS\Request::i()->method ) )
|
||||
if( isset( Request::i()->method ) )
|
||||
{
|
||||
$redirectUrl = $redirectUrl->setQueryString( 'method', \IPS\Request::i()->method );
|
||||
$redirectUrl = $redirectUrl->setQueryString( 'method', Request::i()->method );
|
||||
}
|
||||
|
||||
/* Output multiredirector */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'converting' );
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect(
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'converting' );
|
||||
Output::i()->output = new MultipleRedirect(
|
||||
/* The multiredirect URL */
|
||||
$redirectUrl,
|
||||
|
||||
@@ -494,10 +524,10 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
/* Are we reconverting using the dev ui and this is the first iteration? */
|
||||
if( $data === NULL )
|
||||
{
|
||||
if( isset( \IPS\Request::i()->method ) )
|
||||
if( isset( Request::i()->method ) )
|
||||
{
|
||||
$session = $app->_session;
|
||||
if( $key = array_search( \IPS\Request::i()->method, $session['completed'] ) )
|
||||
if( $key = array_search( Request::i()->method, $session['completed'] ) )
|
||||
{
|
||||
unset( $session['completed'][ $key ] );
|
||||
$app->_session = $session;
|
||||
@@ -517,19 +547,19 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
/* If we are moving on to a different app, load it now */
|
||||
if( $convertData['id'] != $app->app_id )
|
||||
{
|
||||
$app = \IPS\convert\App::load( $convertData['id'] );
|
||||
$app = App::load( $convertData['id'] );
|
||||
}
|
||||
|
||||
/* Convert settings if that's what we're doing */
|
||||
if( $convertData['method'] == 'convertSettings' )
|
||||
{
|
||||
$app->getSource()->convertSettings( $app->_session['more_info']['convertSettings'] );
|
||||
\IPS\Settings::i()->clearCache();
|
||||
Settings::i()->clearCache();
|
||||
|
||||
/* A Software Exception indicates we are done */
|
||||
$completed = $app->_session['completed'];
|
||||
$more_info = $app->_session['more_info'];
|
||||
if ( !\in_array( $convertData['method'], $completed ) )
|
||||
if ( !in_array( $convertData['method'], $completed ) )
|
||||
{
|
||||
$completed[] = $convertData['method'];
|
||||
}
|
||||
@@ -540,12 +570,12 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
|
||||
$app->_session = array( 'working' => array(), 'more_info' => $more_info, 'completed' => $completed, 'running' => $running );
|
||||
|
||||
$percentage = 100 / \IPS\convert\Library::getTotalCachedRows( $app->getMasterConversionId() );
|
||||
$percentage = 100 / Library::getTotalCachedRows( $app->getMasterConversionId() );
|
||||
if ( $percentage > 100 )
|
||||
{
|
||||
$percentage = 100;
|
||||
}
|
||||
return array( 0, sprintf( \IPS\Member::loggedIn()->language()->get( 'converted_x_of_x' ), 1, 1, \IPS\Member::loggedIn()->language()->addToStack( '_convert_settings' ) ), $percentage );
|
||||
return array( 0, sprintf( Member::loggedIn()->language()->get( 'converted_x_of_x' ), 1, 1, Member::loggedIn()->language()->addToStack( '_convert_settings' ) ), $percentage );
|
||||
}
|
||||
|
||||
try
|
||||
@@ -558,22 +588,22 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
|
||||
return $app->getSource()->getLibrary()->process( $data, $convertData['method'], $app->getSource()->getLibrary()->getMethodFromMenuRows( $convertData['method'] )['per_cycle'] );
|
||||
}
|
||||
catch( \IPS\convert\Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=error&id={$app->app_id}" ) );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&do=error&id={$app->app_id}" ) );
|
||||
}
|
||||
},
|
||||
|
||||
/* The final function to run */
|
||||
function() use ( $app )
|
||||
{
|
||||
if( \IPS\CONVERTERS_DEV_UI AND isset( \IPS\Request::i()->method ) )
|
||||
if( CONVERTERS_DEV_UI AND isset( Request::i()->method ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=manage&id=" . ( $app->parent ?: $app->app_id ) ) );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&do=manage&id=" . ( $app->parent ?: $app->app_id ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=finish&wasConfirmed=1&id=" . ( $app->parent ?: $app->app_id ) )->csrf() );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&do=finish&wasConfirmed=1&id=" . ( $app->parent ?: $app->app_id ) )->csrf() );
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -582,22 +612,22 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Check if we need to configure this conversion step
|
||||
*
|
||||
* @param \IPS\convert\App $app App we are converting
|
||||
* @param App $app App we are converting
|
||||
* @return bool
|
||||
*/
|
||||
protected function _checkMethodConfiguration( $app )
|
||||
{
|
||||
$softwareClass = $app->getSource();
|
||||
|
||||
if ( \in_array( \IPS\Request::i()->method, $softwareClass::checkConf() ) )
|
||||
if ( in_array( Request::i()->method, $softwareClass::checkConf() ) )
|
||||
{
|
||||
$getMoreInfo = $softwareClass->getMoreInfo( \IPS\Request::i()->method );
|
||||
if ( \is_array( $getMoreInfo ) AND \count( $getMoreInfo ) )
|
||||
$getMoreInfo = $softwareClass->getMoreInfo( Request::i()->method );
|
||||
if ( is_array( $getMoreInfo ) AND count( $getMoreInfo ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( \IPS\Request::i()->method . '_more_info', 'continue' );
|
||||
$form->hiddenValues['per_cycle'] = \IPS\Request::i()->per_cycle;
|
||||
$form = new Form( Request::i()->method . '_more_info', 'continue' );
|
||||
$form->hiddenValues['per_cycle'] = Request::i()->per_cycle;
|
||||
|
||||
if ( isset( \IPS\Request::i()->reconfigure ) )
|
||||
if ( isset( Request::i()->reconfigure ) )
|
||||
{
|
||||
$form->hiddenValues['reconfigure'] = 1;
|
||||
}
|
||||
@@ -609,7 +639,7 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
$form->add( new $fieldClass( $key, $input['field_default'], $input['field_required'], $input['field_extra'], isset( $input['field_validation'] ) ? $input['field_validation'] : NULL ) );
|
||||
if ( $input['field_hint'] !== NULL )
|
||||
{
|
||||
$form->addMessage( $input['field_hint'], 'ipsMessage ipsMessage_info' );
|
||||
$form->addMessage( $input['field_hint'], 'ipsMessage ipsMessage--info' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,13 +648,13 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
$per_cycle = $values['per_cycle'];
|
||||
unset( $values['per_cycle'] );
|
||||
|
||||
$app->saveMoreInfo( \IPS\Request::i()->method, $values );
|
||||
$app->saveMoreInfo( Request::i()->method, $values );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=runStep&id={$app->app_id}&per_cycle={$per_cycle}&method=" . \IPS\Request::i()->method )->csrf() );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&do=runStep&id={$app->app_id}&per_cycle={$per_cycle}&method=" . Request::i()->method )->csrf() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'more_info_needed' );
|
||||
\IPS\Output::i()->output = $form;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'more_info_needed' );
|
||||
Output::i()->output = $form;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -639,25 +669,25 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
if ( !isset( \IPS\Request::i()->id ) )
|
||||
if ( !isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V101/8' );
|
||||
Output::i()->error( 'no_conversion_app', '2V101/8' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '2V101/9', 404 );
|
||||
Output::i()->error( 'conversion_app_not_found', '2V101/9', 404 );
|
||||
}
|
||||
|
||||
/* Load the last actual error logged */
|
||||
$error = \IPS\Db::i()->select( '*', 'convert_logs', array( 'log_app=?', $app->app_id ), 'log_id DESC', 1 )->first();
|
||||
$error = Db::i()->select( '*', 'convert_logs', array( 'log_app=?', $app->app_id ), 'log_id DESC', 1 )->first();
|
||||
|
||||
/* Just use generic error wrapper */
|
||||
\IPS\Output::i()->error( $error['log_method'] . ': ' . $error['log_message'], '2V101/A' );
|
||||
Output::i()->error( $error['log_method'] . ': ' . $error['log_message'], '2V101/A' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -667,49 +697,49 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function settings()
|
||||
{
|
||||
if ( !isset( \IPS\Request::i()->id ) )
|
||||
if ( !isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V101/B' );
|
||||
Output::i()->error( 'no_conversion_app', '2V101/B' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '2V101/C', 404 );
|
||||
Output::i()->error( 'conversion_app_not_found', '2V101/C', 404 );
|
||||
}
|
||||
|
||||
$softwareClass = $app->getSource();
|
||||
|
||||
if ( $softwareClass::canConvertSettings() === FALSE )
|
||||
{
|
||||
\IPS\Output::i()->error( 'settings_conversion_not_supported', '2V101/D' );
|
||||
Output::i()->error( 'settings_conversion_not_supported', '2V101/D' );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form = new Form;
|
||||
foreach( $softwareClass->settingsMapList() as $key => $setting )
|
||||
{
|
||||
$value = $setting['value'];
|
||||
if ( \is_bool( ( $setting['value'] ) ) )
|
||||
if ( is_bool( ( $setting['value'] ) ) )
|
||||
{
|
||||
$value = $setting['value'] === TRUE ? 'On' : 'Off';
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( $setting['our_key'], TRUE, FALSE, array( 'label' => $value ) ) );
|
||||
$form->add( new Checkbox( $setting['our_key'], TRUE, FALSE, array( 'label' => $value ) ) );
|
||||
}
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$softwareClass->convertSettings( $values );
|
||||
\IPS\Settings::i()->clearCache();
|
||||
Settings::i()->clearCache();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&id={$app->app_id}" ), 'saved' );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&id={$app->app_id}" ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'converting_settings' );
|
||||
\IPS\Output::i()->output = $form;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'converting_settings' );
|
||||
Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -719,22 +749,22 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
if ( !isset( \IPS\Request::i()->id ) )
|
||||
if ( !isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V101/E' );
|
||||
Output::i()->error( 'no_conversion_app', '2V101/E' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\output::i()->error( 'conversion_app_not_found', '2V101/F', 404 );
|
||||
output::i()->error( 'conversion_app_not_found', '2V101/F', 404 );
|
||||
}
|
||||
|
||||
/* Make sure the user confirmed they want to finish */
|
||||
\IPS\Request::i()->confirmedDelete( 'convert_finish_confirm_title', 'convert_finish_confirm', 'finish' );
|
||||
Request::i()->confirmedDelete( 'convert_finish_confirm_title', 'convert_finish_confirm', 'finish' );
|
||||
|
||||
$softwareClass = $app->getSource();
|
||||
|
||||
@@ -745,53 +775,53 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( $app->parent )
|
||||
{
|
||||
$parent = \IPS\convert\App::load( $app->parent );
|
||||
$parent = App::load( $app->parent );
|
||||
|
||||
if ( method_exists( $parent->getSource(), 'finish' ) AND !$parent->finished )
|
||||
{
|
||||
$return = $parent->getSource()->finish();
|
||||
$parent->log( 'app_finished', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$parent->log( 'app_finished', __METHOD__, App::LOG_NOTICE );
|
||||
$parent->finished = TRUE;
|
||||
$parent->save();
|
||||
|
||||
if ( \is_array( $return ) )
|
||||
if ( is_array( $return ) )
|
||||
{
|
||||
$messages = array_merge( $messages, $return );
|
||||
}
|
||||
}
|
||||
elseif( $parent->finished )
|
||||
{
|
||||
$parent->log( 'app_finished_skipped', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$parent->log( 'app_finished_skipped', __METHOD__, App::LOG_NOTICE );
|
||||
}
|
||||
|
||||
/* Run siblings if need be */
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'convert_apps', array( "parent=? AND app_id!=?", $parent->app_id, $app->app_id ) ), 'IPS\convert\App' ) AS $sibling )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'convert_apps', array( "parent=? AND app_id!=?", $parent->app_id, $app->app_id ) ), 'IPS\convert\App' ) AS $sibling )
|
||||
{
|
||||
if ( method_exists( $sibling->getSource(), 'finish' ) AND !$sibling->finished )
|
||||
{
|
||||
$return = $sibling->getSource()->finish();
|
||||
$sibling->log( 'app_finished', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$sibling->log( 'app_finished', __METHOD__, App::LOG_NOTICE );
|
||||
$sibling->finished = TRUE;
|
||||
$sibling->save();
|
||||
|
||||
if ( \is_array( $return ) )
|
||||
if ( is_array( $return ) )
|
||||
{
|
||||
$messages = array_merge( $messages, $return );
|
||||
}
|
||||
}
|
||||
elseif( $sibling->finished )
|
||||
{
|
||||
$sibling->log( 'app_finished_skipped', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$sibling->log( 'app_finished_skipped', __METHOD__, App::LOG_NOTICE );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No parent - bubble up to the exception */
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
/* This is a parent - run it's children */
|
||||
foreach( $app->children() AS $child )
|
||||
@@ -801,18 +831,18 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
if ( method_exists( $childSoftwareClass, 'finish' ) AND !$child->finished )
|
||||
{
|
||||
$return = $childSoftwareClass->finish();
|
||||
$child->log( 'app_finished', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$child->log( 'app_finished', __METHOD__, App::LOG_NOTICE );
|
||||
$child->finished = TRUE;
|
||||
$child->save();
|
||||
|
||||
if ( \is_array( $return ) )
|
||||
if ( is_array( $return ) )
|
||||
{
|
||||
$messages = array_merge( $messages, $return );
|
||||
}
|
||||
}
|
||||
elseif( $child->finished )
|
||||
{
|
||||
$child->log( 'app_finished_skipped', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$child->log( 'app_finished_skipped', __METHOD__, App::LOG_NOTICE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -821,30 +851,30 @@ class _convert extends \IPS\Dispatcher\Controller
|
||||
if ( method_exists( $softwareClass, 'finish' ) AND !$app->finished )
|
||||
{
|
||||
$return = $softwareClass->finish();
|
||||
$app->log( 'app_finished', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$app->log( 'app_finished', __METHOD__, App::LOG_NOTICE );
|
||||
$app->finished = TRUE;
|
||||
$app->save();
|
||||
|
||||
if ( \is_array( $return ) )
|
||||
if ( is_array( $return ) )
|
||||
{
|
||||
$messages = array_merge( $messages, $return );
|
||||
}
|
||||
}
|
||||
elseif( $app->finished )
|
||||
{
|
||||
$app->log( 'app_finished_skipped', __METHOD__, \IPS\convert\App::LOG_NOTICE );
|
||||
$app->log( 'app_finished_skipped', __METHOD__, App::LOG_NOTICE );
|
||||
}
|
||||
|
||||
/* Any Messages? */
|
||||
if( !\count( $messages ) )
|
||||
if( !count( $messages ) )
|
||||
{
|
||||
$messages = array( 'nothing_to_finish' );
|
||||
}
|
||||
|
||||
$messages = array_map( function( $key ) {
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( $key );
|
||||
return Member::loggedIn()->language()->addToStack( $key );
|
||||
}, $messages );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=manage" ), \IPS\Member::loggedIn()->language()->formatList( $messages ) );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=manage" ), Member::loggedIn()->language()->formatList( $messages ) );
|
||||
}
|
||||
}
|
||||
@@ -12,21 +12,54 @@
|
||||
namespace IPS\convert\modules\admin\manage;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Convert\Exception;
|
||||
use IPS\convert\Library;
|
||||
use IPS\convert\Software;
|
||||
use IPS\DB;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Checkbox;
|
||||
use IPS\Helpers\Form\CheckboxSet;
|
||||
use IPS\Helpers\Form\Number;
|
||||
use IPS\Helpers\Form\Password;
|
||||
use IPS\Helpers\Form\Select;
|
||||
use IPS\Helpers\Form\Text;
|
||||
use IPS\Helpers\Form\YesNo;
|
||||
use IPS\Helpers\Wizard;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
use OutOfRangeException;
|
||||
use UnderflowException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function is_bool;
|
||||
use const IPS\DEMO_MODE;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new conversion session
|
||||
*/
|
||||
class _create extends \IPS\Dispatcher\Controller
|
||||
class create extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
@@ -37,13 +70,13 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( \IPS\CIC )
|
||||
{
|
||||
\IPS\Output::i()->error( 'module_no_permission', '2V391/3', 403, '' );
|
||||
Output::i()->error( 'module_no_permission', '2V391/3', 403, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->responsive = FALSE;
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'create_manage' );
|
||||
Output::i()->responsive = FALSE;
|
||||
Dispatcher::i()->checkAcpPermission( 'create_manage' );
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'convert.css' ) );
|
||||
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'convert.css' ) );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -55,27 +88,27 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* We only use the Wizard helper for starting a conversion, so we need to make sure it is always starting new and not using old session data */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'convert_start' );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'convert_start' );
|
||||
|
||||
/* Let's call on the wizard to make some magic */
|
||||
\IPS\Output::i()->output = (string) new \IPS\Helpers\Wizard( array(
|
||||
Output::i()->output = (string) new Wizard( array(
|
||||
'convert_start_source_software' => array( $this, '_chooseSoftware' ),
|
||||
'convert_start_application' => array( $this, '_chooseApplications' ),
|
||||
'convert_start_database_details' => array( $this, '_setDatabaseDetails' ),
|
||||
'convert_start_conversion_details' => array( $this, '_setConversionDetails' ),
|
||||
), \IPS\Http\Url::internal( 'app=convert&module=manage&controller=create' ) );
|
||||
), Url::internal( 'app=convert&module=manage&controller=create' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose what software you want to convert from
|
||||
*
|
||||
* @param array $data Wizard data from previous steps
|
||||
* @return \IPS\Helpers\Form|array
|
||||
* @return Form|array
|
||||
*/
|
||||
public function _chooseSoftware( $data )
|
||||
{
|
||||
$options = array();
|
||||
foreach( \IPS\convert\Software::software()['core'] AS $key => $classname )
|
||||
foreach( Software::software()['core'] AS $key => $classname )
|
||||
{
|
||||
if ( class_exists( $classname ) AND $classname::canConvert() !== NULL )
|
||||
{
|
||||
@@ -83,8 +116,8 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'convert_source_software', 'choose_what_to_convert' );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'convert_start_source_software', NULL, TRUE, array( 'options' => $options ) ) );
|
||||
$form = new Form( 'convert_source_software', 'choose_what_to_convert' );
|
||||
$form->add( new Select( 'convert_start_source_software', NULL, TRUE, array( 'options' => $options ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -98,33 +131,33 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
* Choose which applications to convert
|
||||
*
|
||||
* @param array $data Wizard data from previous steps
|
||||
* @return \IPS\Helpers\Form|array
|
||||
* @return Form|array
|
||||
*/
|
||||
public function _chooseApplications( $data )
|
||||
{
|
||||
/* Figure out what converter libraries we have for the selected application */
|
||||
$software = $data['convert_start_source_software'];
|
||||
$applications = array( 'core' => \IPS\Member::loggedIn()->language()->addToStack( 'core_node_select' ) );
|
||||
$applications = array( 'core' => Member::loggedIn()->language()->addToStack( 'core_node_select' ) );
|
||||
|
||||
foreach( \IPS\convert\Library::libraries() AS $key => $class )
|
||||
foreach( Library::libraries() AS $key => $class )
|
||||
{
|
||||
/* Check app is installed and enabled */
|
||||
if( !\IPS\Application::appIsEnabled( $key ) )
|
||||
if( !Application::appIsEnabled( $key ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach( \IPS\convert\Software::software()[ $key ] AS $softwareKey => $softwareClass )
|
||||
foreach( Software::software()[ $key ] AS $softwareKey => $softwareClass )
|
||||
{
|
||||
if( $softwareKey == $software )
|
||||
{
|
||||
$applications[ $key ] = \IPS\Member::loggedIn()->language()->addToStack( $key . '_node_select' );
|
||||
$applications[ $key ] = Member::loggedIn()->language()->addToStack( $key . '_node_select' );
|
||||
}
|
||||
elseif( isset( $softwareClass::parents()['core'] ) )
|
||||
{
|
||||
if( \in_array( $software, $softwareClass::parents()['core'] ) )
|
||||
if( in_array( $software, $softwareClass::parents()['core'] ) )
|
||||
{
|
||||
$applications[ $key . '_' . $softwareKey ] = \IPS\Member::loggedIn()->language()->get( $key . '_node_select' ) . ' - ' . $softwareClass::softwareName();
|
||||
$applications[ $key . '_' . $softwareKey ] = Member::loggedIn()->language()->get( $key . '_node_select' ) . ' - ' . $softwareClass::softwareName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,13 +172,13 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
});
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'convert_application', 'enter_database_details' );
|
||||
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'choose_what_to_convert', array_keys( $preSelected ), FALSE, array( 'options' => $applications, 'disabled' => array( 'core' ) ) ) );
|
||||
$form = new Form( 'convert_application', 'enter_database_details' );
|
||||
$form->add( new CheckboxSet( 'choose_what_to_convert', array_keys( $preSelected ), FALSE, array( 'options' => $applications, 'disabled' => array( 'core' ) ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Core is required, and it was disabled on the form, so make sure it's in the array just to prevent people breaking stuff intentionally */
|
||||
if( !\in_array( 'core', $values['choose_what_to_convert'] ) )
|
||||
if( !in_array( 'core', $values['choose_what_to_convert'] ) )
|
||||
{
|
||||
$values['choose_what_to_convert'][] = 'core';
|
||||
}
|
||||
@@ -160,11 +193,11 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
* Allow the admin to supply the needed details
|
||||
*
|
||||
* @param array $data Wizard data from previous steps
|
||||
* @return \IPS\Helpers\Form|array
|
||||
* @return Form|array
|
||||
*/
|
||||
public function _setDatabaseDetails( $data )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'convert_database_details', 'enter_conversion_details' );
|
||||
$form = new Form( 'convert_database_details', 'enter_conversion_details' );
|
||||
|
||||
$usePrefix = NULL;
|
||||
|
||||
@@ -173,16 +206,16 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
if( mb_stristr( $application, '_' ) )
|
||||
{
|
||||
$converter = explode( '_', $application );
|
||||
$classname = \IPS\convert\Software::software()[ $converter[0] ] [ $converter[1] ];
|
||||
$classname = Software::software()[ $converter[0] ] [ $converter[1] ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$classname = \IPS\convert\Software::software()[ $application ] [ mb_strtolower( $data['convert_start_source_software'] ) ];
|
||||
$classname = Software::software()[ $application ] [ mb_strtolower( $data['convert_start_source_software'] ) ];
|
||||
}
|
||||
|
||||
if ( $classname::getPreConversionInformation() !== NULL )
|
||||
{
|
||||
$form->addMessage( \IPS\Member::loggedIn()->language()->addToStack( $classname::getPreConversionInformation() ), '', FALSE );
|
||||
$form->addMessage( Member::loggedIn()->language()->addToStack( $classname::getPreConversionInformation() ), '', FALSE );
|
||||
}
|
||||
|
||||
if( $application == 'core' )
|
||||
@@ -191,24 +224,24 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'convert_start_database_host', NULL, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'convert_start_database_port', 3306, FALSE, array( 'max' => 65535, 'min' => 1 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'convert_start_database_name', NULL, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'convert_start_database_user', NULL, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Password( 'convert_start_database_pass', NULL, FALSE ) );
|
||||
$form->add( new Text( 'convert_start_database_host', NULL, FALSE ) );
|
||||
$form->add( new Number( 'convert_start_database_port', 3306, FALSE, array( 'max' => 65535, 'min' => 1 ) ) );
|
||||
$form->add( new Text( 'convert_start_database_name', NULL, FALSE ) );
|
||||
$form->add( new Text( 'convert_start_database_user', NULL, FALSE ) );
|
||||
$form->add( new Password( 'convert_start_database_pass', NULL, FALSE ) );
|
||||
|
||||
/* If the source software doesn't use a prefix, then we should not ask for one to avoid confusion. */
|
||||
if ( $usePrefix )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'convert_start_database_prefix', NULL, FALSE ) );
|
||||
$form->add( new Text( 'convert_start_database_prefix', NULL, FALSE ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'convert_start_database_charset', NULL, FALSE, array( 'placeholder' => 'utf8mb4' ) ) );
|
||||
$form->add( new Text( 'convert_start_database_charset', NULL, FALSE, array( 'placeholder' => 'utf8mb4' ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Start the (core) app object */
|
||||
$app = new \IPS\convert\App;
|
||||
$app = new App;
|
||||
$app->sw = 'core';
|
||||
$app->app_key = $data['convert_start_source_software'];
|
||||
$app->parent = 0;
|
||||
@@ -235,18 +268,18 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
$connectionSettings['sql_utf8mb4'] = TRUE;
|
||||
}
|
||||
|
||||
$db = \IPS\Db::i( 'convertertest', $connectionSettings );
|
||||
$db = Db::i( 'convertertest', $connectionSettings );
|
||||
$db->checkConnection();
|
||||
|
||||
/* Now test the charset */
|
||||
if ( $values['convert_start_database_charset'] AND !\in_array( $values['convert_start_database_charset'], array( 'utf8', 'utf8mb4' ) ) )
|
||||
if ( $values['convert_start_database_charset'] AND !in_array( $values['convert_start_database_charset'], array( 'utf8', 'utf8mb4' ) ) )
|
||||
{
|
||||
/* Get all db charsets and make sure the one we entered is valid */
|
||||
$charsets = \IPS\convert\Software::getDatabaseCharsets( $db );
|
||||
$charsets = Software::getDatabaseCharsets( $db );
|
||||
|
||||
if ( !\in_array( mb_strtolower( $values['convert_start_database_charset'] ), $charsets ) )
|
||||
if ( !in_array( mb_strtolower( $values['convert_start_database_charset'] ), $charsets ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( 'invalid_charset' );
|
||||
throw new InvalidArgumentException( 'invalid_charset' );
|
||||
}
|
||||
|
||||
$db->set_charset( $values['convert_start_database_charset'] );
|
||||
@@ -257,7 +290,7 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
|
||||
foreach( $data['choose_what_to_convert'] as $application )
|
||||
{
|
||||
$childApp = new \IPS\convert\App;
|
||||
$childApp = new App;
|
||||
|
||||
if( mb_stristr( $application, '_' ) )
|
||||
{
|
||||
@@ -291,12 +324,12 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$appClass->countRows( $testAgainst['table'] );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
throw new \InvalidArgumentException( 'invalid_prefix' );
|
||||
throw new InvalidArgumentException( 'invalid_prefix' );
|
||||
}
|
||||
/* Can't find the table */
|
||||
catch( \IPS\convert\Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
if( $appToCheck->sw != 'core' )
|
||||
{
|
||||
@@ -310,16 +343,16 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
if( $e->getMessage() == 'invalid_charset' )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('convert_cant_connect_db_charset');
|
||||
$form->error = Member::loggedIn()->language()->addToStack('convert_cant_connect_db_charset');
|
||||
return $form;
|
||||
}
|
||||
else if( $e->getMessage() == 'invalid_prefix' )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('convert_cant_connect_db_prefix');
|
||||
$form->error = Member::loggedIn()->language()->addToStack('convert_cant_connect_db_prefix');
|
||||
return $form;
|
||||
}
|
||||
else
|
||||
@@ -329,7 +362,7 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('convert_cant_connect_db');
|
||||
$form->error = Member::loggedIn()->language()->addToStack('convert_cant_connect_db');
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -343,12 +376,12 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
/* Check for existing apps */
|
||||
try
|
||||
{
|
||||
$existingApp = \IPS\DB::i()->select( '*', 'convert_apps', array( 'sw=? AND app_key=? AND db_host=? AND db_db=? AND db_user=? AND db_pass=? AND db_prefix=?', $app->sw, $app->app_key, $app->db_host, $app->db_db, $app->db_user, $app->db_pass, $app->db_prefix ) )->first();
|
||||
$existingApp = DB::i()->select( '*', 'convert_apps', array( 'sw=? AND app_key=? AND db_host=? AND db_db=? AND db_user=? AND db_pass=? AND db_prefix=?', $app->sw, $app->app_key, $app->db_host, $app->db_db, $app->db_user, $app->db_pass, $app->db_prefix ) )->first();
|
||||
|
||||
/* App already exists */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&id={$existingApp['app_id']}" ), 'conversion_app_already_exists' );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&id={$existingApp['app_id']}" ), 'conversion_app_already_exists' );
|
||||
}
|
||||
catch( \UnderflowException $e ) { }
|
||||
catch( UnderflowException $e ) { }
|
||||
|
||||
if ( !empty( $values['convert_start_database_charset'] ) )
|
||||
{
|
||||
@@ -369,7 +402,7 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
if( \in_array( $application, $childAppsToRemove ) )
|
||||
if( in_array( $application, $childAppsToRemove ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -403,25 +436,25 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
* Allow the admin to supply the needed details
|
||||
*
|
||||
* @param array $data Wizard data from previous steps
|
||||
* @return \IPS\Helpers\Form
|
||||
* @return Form
|
||||
*/
|
||||
public function _setConversionDetails( $data )
|
||||
{
|
||||
/* We may be coming here from a previously incomplete conversion setup...detect and set the parent app ID appropriately */
|
||||
if( ( !isset( $data['_app_parent'] ) OR !$data['_app_parent'] ) AND isset( \IPS\Request::i()->id ) )
|
||||
if( ( !isset( $data['_app_parent'] ) OR !$data['_app_parent'] ) AND isset( Request::i()->id ) )
|
||||
{
|
||||
$data['_app_parent'] = \IPS\Request::i()->id;
|
||||
$data['_app_parent'] = Request::i()->id;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'convert_other_details', 'start_conversion' );
|
||||
$form = new Form( 'convert_other_details', 'start_conversion' );
|
||||
|
||||
try
|
||||
{
|
||||
$parentApplication = \IPS\convert\App::load( $data['_app_parent'] );
|
||||
$parentApplication = App::load( $data['_app_parent'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '3V391/1', 404, '' );
|
||||
Output::i()->error( 'conversion_app_not_found', '3V391/1', 404, '' );
|
||||
}
|
||||
|
||||
$this->_addConversionApplication( $parentApplication, $form );
|
||||
@@ -436,14 +469,14 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
/* We know the core/parent app is fine, but any child apps that don't have 'more_info' should be deleted as they cannot be converted */
|
||||
foreach( $parentApplication->children() as $childApplication )
|
||||
{
|
||||
if( !\count( $childApplication->_session['more_info'] ) )
|
||||
if( !count( $childApplication->_session['more_info'] ) )
|
||||
{
|
||||
$childApplication->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/* We have already saved our custom configuration, so now we can head off to the races */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&id={$data['_app_parent']}" ) );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=convert&id={$data['_app_parent']}" ) );
|
||||
}
|
||||
|
||||
return $form;
|
||||
@@ -452,8 +485,8 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Add form elements for the specified application to the form
|
||||
*
|
||||
* @param \IPS\convert\App $app Conversion application
|
||||
* @param \IPS\Helpers\Form $form Form object
|
||||
* @param App $app Conversion application
|
||||
* @param Form $form Form object
|
||||
* @return void
|
||||
*/
|
||||
protected function _addConversionApplication( $app, &$form )
|
||||
@@ -462,16 +495,16 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
$libraryClass = $softwareClass->getLibrary();
|
||||
|
||||
/* Add a nice little header to the form */
|
||||
$form->addHeader( \IPS\Member::loggedIn()->language()->addToStack( 'converting_x_to_x', FALSE, array( 'sprintf' => array( $softwareClass::softwareName(), \IPS\Application::load( $app->sw )->_title ) ) ) );
|
||||
$form->addHeader( Member::loggedIn()->language()->addToStack( 'converting_x_to_x', FALSE, array( 'sprintf' => array( $softwareClass::softwareName(), Application::load( $app->sw )->_title ) ) ) );
|
||||
|
||||
/* Now fetch the details about this application we are converting so we can build the appropriate form elements */
|
||||
try
|
||||
{
|
||||
$menuRows = \IPS\convert\modules\admin\manage\convert::getMenuRows( $softwareClass, TRUE, TRUE );
|
||||
$menuRows = convert::getMenuRows( $softwareClass, TRUE, TRUE );
|
||||
}
|
||||
catch( \IPS\Convert\Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage_warning', TRUE );
|
||||
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage--warning', TRUE );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -483,17 +516,17 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
foreach( $softwareClass->settingsMapList() as $key => $setting )
|
||||
{
|
||||
$value = $setting['value'];
|
||||
if ( \is_bool( ( $setting['value'] ) ) )
|
||||
if ( is_bool( ( $setting['value'] ) ) )
|
||||
{
|
||||
$value = $setting['value'] === TRUE ? 'On' : 'Off';
|
||||
}
|
||||
|
||||
$settings[ $setting['our_key'] ] = new \IPS\Helpers\Form\Checkbox( $setting['our_key'], TRUE, FALSE, array( 'label' => $value ), NULL, NULL, NULL, $setting['our_key'] );
|
||||
$settings[ $setting['our_key'] ] = new Checkbox( $setting['our_key'], TRUE, FALSE, array( 'label' => $value ), NULL, NULL, NULL, $setting['our_key'] );
|
||||
}
|
||||
|
||||
/* Add a nice little header to the form */
|
||||
$form->addHeader( 'convert_settings' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'convert_settings', TRUE, TRUE, array( 'togglesOn' => array_keys( $settings ) ) ) );
|
||||
$form->add( new YesNo( 'convert_settings', TRUE, TRUE, array( 'togglesOn' => array_keys( $settings ) ) ) );
|
||||
|
||||
foreach( $settings as $settingFormField )
|
||||
{
|
||||
@@ -503,7 +536,7 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
/* Did we just submit? If so save our configuration */
|
||||
if( $values = $form->values() )
|
||||
{
|
||||
$values = array_filter( $values, function( $key ) use ( $settings ) { return $key == 'convert_settings' OR \in_array( $key, array_keys( $settings ) ); }, ARRAY_FILTER_USE_KEY );
|
||||
$values = array_filter( $values, function( $key ) use ( $settings ) { return $key == 'convert_settings' OR in_array( $key, array_keys( $settings ) ); }, ARRAY_FILTER_USE_KEY );
|
||||
|
||||
$app->saveMoreInfo( 'convertSettings', $values );
|
||||
}
|
||||
@@ -515,10 +548,10 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
/* Determine if this step has any extra configuration questions */
|
||||
$formElements = array();
|
||||
|
||||
if ( \in_array( $row['step_method'], $softwareClass::checkConf() ) )
|
||||
if ( in_array( $row['step_method'], $softwareClass::checkConf() ) )
|
||||
{
|
||||
$getMoreInfo = $softwareClass->getMoreInfo( $row['step_method'] );
|
||||
if ( \is_array( $getMoreInfo ) AND \count( $getMoreInfo ) )
|
||||
if ( is_array( $getMoreInfo ) AND count( $getMoreInfo ) )
|
||||
{
|
||||
/* Show the 'more info' fields */
|
||||
foreach( $getMoreInfo as $key => $input )
|
||||
@@ -527,16 +560,16 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
$formElements[ $key ] = new $fieldClass( $key, $input['field_default'], $input['field_required'], $input['field_extra'], isset( $input['field_validation'] ) ? $input['field_validation'] : NULL, NULL, NULL, $key );
|
||||
if ( $input['field_hint'] !== NULL )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $key . '_desc' ] = $input['field_hint'];
|
||||
Member::loggedIn()->language()->words[ $key . '_desc' ] = $input['field_hint'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form->addHeader( $row['step_title'] );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( $row['step_title'], TRUE, TRUE, array( 'togglesOn' => array_keys( $formElements ) ) ) );
|
||||
$form->add( new YesNo( $row['step_title'], TRUE, TRUE, array( 'togglesOn' => array_keys( $formElements ) ) ) );
|
||||
|
||||
if( \count( $formElements ) )
|
||||
if( count( $formElements ) )
|
||||
{
|
||||
foreach( $formElements as $key => $element )
|
||||
{
|
||||
@@ -547,22 +580,22 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
/* Did we just submit? If so save our configuration */
|
||||
if( $values = $form->values() )
|
||||
{
|
||||
$values = array_filter( $values, function( $key ) use ( $formElements, $row ) { return $key == $row['step_title'] OR \in_array( $key, array_keys( $formElements ) ); }, ARRAY_FILTER_USE_KEY );
|
||||
$values = array_filter( $values, function( $key ) use ( $formElements, $row ) { return $key == $row['step_title'] OR in_array( $key, array_keys( $formElements ) ); }, ARRAY_FILTER_USE_KEY );
|
||||
|
||||
$app->saveMoreInfo( $row['step_method'], $values );
|
||||
}
|
||||
}
|
||||
|
||||
/* If there was nothing to convert, show an appropriate message */
|
||||
if( $softwareClass::canConvertSettings() === FALSE AND !\count( $menuRows ) )
|
||||
if( $softwareClass::canConvertSettings() === FALSE AND !count( $menuRows ) )
|
||||
{
|
||||
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage_warning', TRUE );
|
||||
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage--warning', TRUE );
|
||||
}
|
||||
|
||||
/* If there is a message to show, go ahead and show it */
|
||||
if( $postConversionMessage = $libraryClass->getPostConversionInformation() )
|
||||
{
|
||||
$form->addMessage( $postConversionMessage, 'ipsMessage ipsMessage_info', FALSE );
|
||||
$form->addMessage( $postConversionMessage, 'ipsMessage ipsMessage--info', FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,21 +12,52 @@
|
||||
namespace IPS\convert\modules\admin\manage;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Number;
|
||||
use IPS\Helpers\Form\Password;
|
||||
use IPS\Helpers\Form\Text;
|
||||
use IPS\Http\Url;
|
||||
use IPS\IPS;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use OutOfRangeException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function file_put_contents;
|
||||
use function get_class;
|
||||
use function in_array;
|
||||
use const IPS\CONVERTERS_DEV_UI;
|
||||
use const IPS\DEMO_MODE;
|
||||
use const IPS\FOLDER_PERMISSION_NO_WRITE;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converter overview
|
||||
*/
|
||||
class _manage extends \IPS\Dispatcher\Controller
|
||||
class manage extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
@@ -35,13 +66,13 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
if ( \IPS\DEMO_MODE === TRUE )
|
||||
if ( DEMO_MODE === TRUE )
|
||||
{
|
||||
\IPS\Output::i()->error( 'demo_mode_function_blocked', '2V407/1', 403, '' );
|
||||
Output::i()->error( 'demo_mode_function_blocked', '2V407/1', 403, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->responsive = FALSE;
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'manage_manage' );
|
||||
Output::i()->responsive = FALSE;
|
||||
Dispatcher::i()->checkAcpPermission( 'manage_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -53,16 +84,16 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* If mod_rewrite is not enabled, advise the administrator that old URLs will not redirect to the new locations automatically */
|
||||
if( !\IPS\Settings::i()->htaccess_mod_rewrite )
|
||||
if( !Settings::i()->htaccess_mod_rewrite )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( 'convert_mod_rewrite_urls', 'warning' );
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'global', 'core' )->message( 'convert_mod_rewrite_urls', 'warning' );
|
||||
}
|
||||
|
||||
/* Remind the user that they must configure permissions after the conversion is complete */
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( 'convert_configure_permissions', 'info' );
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'global', 'core' )->message( 'convert_configure_permissions', 'info' );
|
||||
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'convert_apps', \IPS\Http\Url::internal( 'app=convert&module=manage&controller=manage' ), array( 'parent=?', 0 ) );
|
||||
$table = new \IPS\Helpers\Table\Db( 'convert_apps', Url::internal( 'app=convert&module=manage&controller=manage' ), array( 'parent=?', 0 ) );
|
||||
$table->langPrefix = 'convert_';
|
||||
$table->include = array( 'app_key', 'sw', 'start_date', 'finished' );
|
||||
|
||||
@@ -86,48 +117,48 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
};
|
||||
|
||||
/* The main row will always be the core application (except for legacy conversions) */
|
||||
$applications = array( \IPS\Application::load( $translate( $val ) )->_title );
|
||||
$applications = array( Application::load( $translate( $val ) )->_title );
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'convert_apps', array( 'parent=?', $row['app_id'] ) ) as $software )
|
||||
foreach( Db::i()->select( '*', 'convert_apps', array( 'parent=?', $row['app_id'] ) ) as $software )
|
||||
{
|
||||
/* Translate the software key, if required */
|
||||
$software['sw'] = $translate( $software['sw'] );
|
||||
|
||||
try
|
||||
{
|
||||
if ( \IPS\CONVERTERS_DEV_UI === TRUE )
|
||||
if ( CONVERTERS_DEV_UI === TRUE )
|
||||
{
|
||||
$continueUrl = \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&id={$software['app_id']}&continue=1" )->csrf();
|
||||
$applications[] = "<a href='{$continueUrl}'>" . \IPS\Application::load( $software['sw'] )->_title . "</a>";
|
||||
$continueUrl = Url::internal( "app=convert&module=manage&controller=convert&id={$software['app_id']}&continue=1" )->csrf();
|
||||
$applications[] = "<a href='{$continueUrl}'>" . Application::load( $software['sw'] )->_title . "</a>";
|
||||
continue;
|
||||
}
|
||||
$applications[] = \IPS\Application::load( $software['sw'] )->_title;
|
||||
$applications[] = Application::load( $software['sw'] )->_title;
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
$applications[] = mb_ucfirst( $software );
|
||||
$applications[] = IPS::mb_ucfirst( $software );
|
||||
}
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->formatList( $applications );
|
||||
return Member::loggedIn()->language()->formatList( $applications );
|
||||
},
|
||||
'app_key' => function( $val, $row )
|
||||
{
|
||||
$app = \IPS\convert\App::constructFromData( $row );
|
||||
$app = App::constructFromData( $row );
|
||||
|
||||
try
|
||||
{
|
||||
$classname = \get_class( $app->getSource(true,false) );
|
||||
$classname = get_class( $app->getSource() );
|
||||
return $classname::softwareName();
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
catch( Exception $ex )
|
||||
{
|
||||
return $val;
|
||||
}
|
||||
},
|
||||
'start_date' => function( $val )
|
||||
{
|
||||
return (string) \IPS\DateTime::ts( $val );
|
||||
return (string) DateTime::ts( $val );
|
||||
},
|
||||
'finished' => function( $val )
|
||||
{
|
||||
@@ -144,27 +175,27 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['start'] = array(
|
||||
Output::i()->sidebar['actions']['start'] = [
|
||||
'primary' => true,
|
||||
'icon' => 'plus',
|
||||
'title' => 'convert_start',
|
||||
'link' => \IPS\Http\Url::internal( "app=convert&module=manage&controller=create&_new=1" ),
|
||||
);
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=create&_new=1" ),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
if ( \IPS\IN_DEV )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['software'] = array(
|
||||
Output::i()->sidebar['actions']['software'] = array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'new_software',
|
||||
'link' => \IPS\Http\Url::internal( "app=convert&module=manage&controller=manage&do=software" ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('new_software') )
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=manage&do=software" ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('new_software') )
|
||||
);
|
||||
\IPS\Output::i()->sidebar['actions']['library'] = array(
|
||||
Output::i()->sidebar['actions']['library'] = array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'new_library',
|
||||
'link' => \IPS\Http\Url::internal( "app=convert&module=manage&controller=manage&do=library" ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('new_library') )
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=manage&do=library" ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('new_library') )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -173,29 +204,29 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
/* Try to load the application to make sure it's installed */
|
||||
\IPS\Application::load( $row['sw'] );
|
||||
Application::load( $row['sw'] );
|
||||
|
||||
/* Try to load the app class - if exception, the converter no longer exists */
|
||||
\IPS\convert\App::constructFromData( $row )->getSource();
|
||||
App::constructFromData( $row )->getSource();
|
||||
|
||||
$return = array();
|
||||
|
||||
if ( !$row['finished'] OR \IPS\CONVERTERS_DEV_UI === TRUE )
|
||||
if ( !$row['finished'] OR CONVERTERS_DEV_UI === TRUE )
|
||||
{
|
||||
$return[] = array(
|
||||
'icon' => 'chevron-circle-right',
|
||||
'title' => 'continue',
|
||||
'link' => \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&id={$row['app_id']}&continue=1" )->csrf()
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=convert&id={$row['app_id']}&continue=1" )->csrf()
|
||||
);
|
||||
|
||||
if( \IPS\CONVERTERS_DEV_UI === TRUE AND !$row['finished'] )
|
||||
if( CONVERTERS_DEV_UI === TRUE AND !$row['finished'] )
|
||||
{
|
||||
$return[] = array(
|
||||
'icon' => 'check',
|
||||
'title' => 'finish',
|
||||
'link' => \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=finish&id={$row['app_id']}" )->csrf(),
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=convert&do=finish&id={$row['app_id']}" )->csrf(),
|
||||
'data' => array(
|
||||
'confirm' => '', 'confirmSubMessage' => \IPS\Member::loggedIn()->language()->get( 'convert_finish_confirm' )
|
||||
'confirm' => '', 'confirmSubMessage' => Member::loggedIn()->language()->get( 'convert_finish_confirm' )
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -203,26 +234,26 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
$return[] = array(
|
||||
'icon' => 'pencil',
|
||||
'title' => 'edit',
|
||||
'link' => \IPS\Http\Url::internal( "app=convert&module=manage&controller=manage&do=edit&id={$row['app_id']}" ),
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=manage&do=edit&id={$row['app_id']}" ),
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
/* Application has been uninstalled */
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
};
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'menu__convert_manage' );
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'menu__convert_manage' );
|
||||
Output::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,11 +265,11 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( \IPS\IN_DEV === FALSE )
|
||||
{
|
||||
\IPS\Output::i()->error( 'new_sofware_not_in_dev', '1V100/1', 403 );
|
||||
Output::i()->error( 'new_sofware_not_in_dev', '1V100/1', 403 );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'classname', NULL, TRUE ) );
|
||||
$form = new Form;
|
||||
$form->add( new Text( 'classname', NULL, TRUE ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -266,24 +297,24 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
$code = str_replace( array( '<#NAMESPACE#>', '<#CLASS#>', '<#CLASS_LOWER#>' ), array( $namespace, $classname, mb_strtolower( $classname ) ), $default );
|
||||
|
||||
/* Check if we need to create a folder */
|
||||
if( \count( $copied ) > 1 )
|
||||
if( count( $copied ) > 1 )
|
||||
{
|
||||
$folder = \IPS\ROOT_PATH . "/applications/{$application}/sources/" . $copied[0];
|
||||
if( !file_exists( $folder ) )
|
||||
{
|
||||
@mkdir( $folder );
|
||||
@chmod( $folder, \IPS\FOLDER_PERMISSION_NO_WRITE );
|
||||
@chmod( $folder, FOLDER_PERMISSION_NO_WRITE );
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate the file */
|
||||
\file_put_contents( $filepath, $code );
|
||||
file_put_contents( $filepath, $code );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=manage" ), 'saved' );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=manage" ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'new_software' );
|
||||
\IPS\Output::i()->output = (string) $form;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'new_software' );
|
||||
Output::i()->output = (string) $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,11 +326,11 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( \IPS\IN_DEV === FALSE )
|
||||
{
|
||||
\IPS\Output::i()->error( 'new_library_not_in_dev', '1V100/2', 403 );
|
||||
Output::i()->error( 'new_library_not_in_dev', '1V100/2', 403 );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'classname', NULL, TRUE ) );
|
||||
$form = new Form;
|
||||
$form->add( new Text( 'classname', NULL, TRUE ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -327,24 +358,24 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
$code = str_replace( array( '<#NAMESPACE#>', '<#CLASS#>', '<#CLASS_LOWER#>' ), array( $namespace, $classname, mb_strtolower( $classname ) ), $default );
|
||||
|
||||
/* Check if we need to create a folder */
|
||||
if( \count( $copied ) > 1 )
|
||||
if( count( $copied ) > 1 )
|
||||
{
|
||||
$folder = \IPS\ROOT_PATH . "/applications/{$application}/sources/" . $copied[0];
|
||||
if( !file_exists( $folder ) )
|
||||
{
|
||||
@mkdir( $folder );
|
||||
@chmod( $folder, \IPS\FOLDER_PERMISSION_NO_WRITE );
|
||||
@chmod( $folder, FOLDER_PERMISSION_NO_WRITE );
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate the file */
|
||||
\file_put_contents( $filepath, $code );
|
||||
file_put_contents( $filepath, $code );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=convert&module=manage&controller=manage' ), 'saved' );
|
||||
Output::i()->redirect( Url::internal( 'app=convert&module=manage&controller=manage' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'new_library' );
|
||||
\IPS\Output::i()->output = (string) $form;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'new_library' );
|
||||
Output::i()->output = (string) $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,38 +385,38 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if ( !isset( \IPS\Request::i()->id ) )
|
||||
if ( !isset( Request::i()->id ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_conversion_app', '2V100/3' );
|
||||
Output::i()->error( 'no_conversion_app', '2V100/3' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$app = \IPS\convert\App::load( \IPS\Request::i()->id );
|
||||
$app = App::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'conversion_app_not_found', '2V100/4', 404 );
|
||||
Output::i()->error( 'conversion_app_not_found', '2V100/4', 404 );
|
||||
}
|
||||
|
||||
$classname = $app->getSource( FALSE );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form = new Form;
|
||||
|
||||
if ( $classname::getPreConversionInformation() !== NULL )
|
||||
{
|
||||
$form->addMessage( \IPS\Member::loggedIn()->language()->addToStack( $classname::getPreConversionInformation() ), '', FALSE );
|
||||
$form->addMessage( Member::loggedIn()->language()->addToStack( $classname::getPreConversionInformation() ), '', FALSE );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'db_host', $app->db_host, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'db_port', $app->db_port, FALSE, array( 'max' => 65535, 'min' => 1 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'db_db', $app->db_db, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'db_user', $app->db_user, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Password( 'db_pass', $app->db_pass, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'db_prefix', $app->db_prefix, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'db_charset', $app->db_charset, FALSE ) );
|
||||
$form->add( new Text( 'db_host', $app->db_host, FALSE ) );
|
||||
$form->add( new Number( 'db_port', $app->db_port, FALSE, array( 'max' => 65535, 'min' => 1 ) ) );
|
||||
$form->add( new Text( 'db_db', $app->db_db, FALSE ) );
|
||||
$form->add( new Text( 'db_user', $app->db_user, FALSE ) );
|
||||
$form->add( new Password( 'db_pass', $app->db_pass, FALSE ) );
|
||||
$form->add( new Text( 'db_prefix', $app->db_prefix, FALSE ) );
|
||||
$form->add( new Text( 'db_charset', $app->db_charset, FALSE ) );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'edit_conversion' );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'edit_conversion' );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -406,17 +437,17 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
$connectionSettings['sql_utf8mb4'] = TRUE;
|
||||
}
|
||||
|
||||
$db = \IPS\Db::i( 'convertertest', $connectionSettings );
|
||||
$db = Db::i( 'convertertest', $connectionSettings );
|
||||
|
||||
/* Now test the charset */
|
||||
if ( $values['db_charset'] AND !\in_array( $values['db_charset'], array( 'utf8', 'utf8mb4' ) ) )
|
||||
if ( $values['db_charset'] AND !in_array( $values['db_charset'], array( 'utf8', 'utf8mb4' ) ) )
|
||||
{
|
||||
/* Get all db charsets and make sure the one we entered is valid */
|
||||
$charsets = \IPS\convert\Software::getDatabaseCharsets( $db );
|
||||
$charsets = Software::getDatabaseCharsets( $db );
|
||||
|
||||
if ( !\in_array( mb_strtolower( $values['db_charset'] ), $charsets ) )
|
||||
if ( !in_array( mb_strtolower( $values['db_charset'] ), $charsets ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( 'invalid_charset' );
|
||||
throw new InvalidArgumentException( 'invalid_charset' );
|
||||
}
|
||||
|
||||
$db->set_charset( $values['db_charset'] );
|
||||
@@ -430,21 +461,21 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( !$db->checkForTable( $testAgainst['table'] ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( 'invalid_prefix' );
|
||||
throw new InvalidArgumentException( 'invalid_prefix' );
|
||||
}
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
if( $e->getMessage() == 'invalid_charset' )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('convert_cant_connect_db_charset');
|
||||
\IPS\Output::i()->output = $form;
|
||||
$form->error = Member::loggedIn()->language()->addToStack('convert_cant_connect_db_charset');
|
||||
Output::i()->output = $form;
|
||||
return;
|
||||
}
|
||||
else if( $e->getMessage() == 'invalid_prefix' )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('convert_cant_connect_db_prefix');
|
||||
\IPS\Output::i()->output = $form;
|
||||
$form->error = Member::loggedIn()->language()->addToStack('convert_cant_connect_db_prefix');
|
||||
Output::i()->output = $form;
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -452,10 +483,10 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('convert_cant_connect_db');
|
||||
\IPS\Output::i()->output = $form;
|
||||
$form->error = Member::loggedIn()->language()->addToStack('convert_cant_connect_db');
|
||||
Output::i()->output = $form;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -480,9 +511,9 @@ class _manage extends \IPS\Dispatcher\Controller
|
||||
$child->save();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=convert&module=manage&controller=manage" ), 'saved' );
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=manage" ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,189 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "renameTable",
|
||||
"params": [
|
||||
"conv_apps",
|
||||
"convert_apps"
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "renameTable",
|
||||
"params": [
|
||||
"conv_link",
|
||||
"convert_link"
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "renameTable",
|
||||
"params": [
|
||||
"conv_link_pms",
|
||||
"convert_link_pms"
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "renameTable",
|
||||
"params": [
|
||||
"conv_link_topics",
|
||||
"convert_link_topics"
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "renameTable",
|
||||
"params": [
|
||||
"conv_link_posts",
|
||||
"convert_link_posts"
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "createTable",
|
||||
"params": [
|
||||
{
|
||||
"name": "convert_logs",
|
||||
"columns": {
|
||||
"log_id": {
|
||||
"name": "log_id",
|
||||
"type": "BIGINT",
|
||||
"length": 20,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": null,
|
||||
"comment": "ID Number",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": true,
|
||||
"binary": false
|
||||
},
|
||||
"log_message": {
|
||||
"name": "log_message",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "Log Message",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"log_app": {
|
||||
"name": "log_app",
|
||||
"type": "BIGINT",
|
||||
"length": 20,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "The conversion app.",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"log_severity": {
|
||||
"name": "log_severity",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "Flag to indicate the type of log (notice, warning, error)",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"log_method": {
|
||||
"name": "log_method",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "Conversion step that triggered this log",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"PRIMARY": {
|
||||
"type": "primary",
|
||||
"name": "PRIMARY",
|
||||
"columns": [
|
||||
"log_id"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
},
|
||||
"log_app": {
|
||||
"type": "key",
|
||||
"name": "log_app",
|
||||
"columns": [
|
||||
"log_app"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"method": "createTable",
|
||||
"params": [
|
||||
{
|
||||
"name": "convert_app_sessions",
|
||||
"columns": {
|
||||
"session_app_id": {
|
||||
"name": "session_app_id",
|
||||
"type": "BIGINT",
|
||||
"length": 20,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "ID Number",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"session_app_data": {
|
||||
"name": "session_app_data",
|
||||
"type": "MEDIUMTEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "Session Data containing rows converted, completed steps, etc.",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"PRIMARY": {
|
||||
"type": "primary",
|
||||
"name": "PRIMARY",
|
||||
"columns": [
|
||||
"session_app_id"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace IPS\convert\setup\upg_100000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Make sure conv_password and conv_password_extra are present and accurate.
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
$queries = array();
|
||||
|
||||
if ( \IPS\Db::i()->checkForColumn( 'core_members', 'conv_password' ) )
|
||||
{
|
||||
$queries[] = array(
|
||||
'table' => 'core_members',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "core_members CHANGE conv_password conv_password VARCHAR(255) null default null;"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$queries[] = array(
|
||||
'table' => 'core_members',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "core_members ADD COLUMN conv_password VARCHAR(255) null default null;"
|
||||
);
|
||||
}
|
||||
|
||||
if ( \IPS\Db::i()->checkForColumn( 'core_members', 'misc' ) )
|
||||
{
|
||||
$queries[] = array(
|
||||
'table' => 'core_members',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "core_members CHANGE misc conv_password_extra VARCHAR(255) null default null;"
|
||||
);
|
||||
}
|
||||
else if ( \IPS\Db::i()->checkForColumn( 'core_members', 'conv_password_extra' ) )
|
||||
{
|
||||
$queries[] = array(
|
||||
'table' => 'core_members',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "core_members CHANGE conv_password_extra conv_password_extra VARCHAR(255) null default null;"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$queries[] = array(
|
||||
'table' => 'core_members',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "core_members ADD conv_password_extra VARCHAR(255) null default null;"
|
||||
);
|
||||
}
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $queries );
|
||||
|
||||
if ( \count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'convert', 'extra' => array( '_upgradeStep' => 2 ) ) );
|
||||
|
||||
/* Queries to run manually */
|
||||
return array( 'html' => \IPS\Theme::i()->getTemplate( 'forms' )->queries( $toRun, \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr_continue' => 1, 'mr' => \IPS\Request::i()->mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"name": "start_date",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace IPS\convert\setup\upg_101003;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Fix 3.x Converter Columns
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
$queries = array();
|
||||
|
||||
/* This does not include all of the columns the 4.x Converters use - only the ones set by the 3.x converters */
|
||||
$old = array(
|
||||
'downloads' => array(
|
||||
array(
|
||||
'table' => 'downloads_categories',
|
||||
'old' => 'conv_parent',
|
||||
'new' => 'cconv_parent'
|
||||
)
|
||||
),
|
||||
'gallery' => array(
|
||||
array(
|
||||
'table' => 'gallery_categories',
|
||||
'old' => 'conv_parent',
|
||||
'new' => 'category_conv_parent'
|
||||
)
|
||||
),
|
||||
'cms' => array(
|
||||
array(
|
||||
'table' => 'cms_database_categories',
|
||||
'old' => 'conv_parent',
|
||||
'new' => 'category_conv_parent',
|
||||
)
|
||||
),
|
||||
'nexus' => array(
|
||||
array(
|
||||
'table' => 'nexus_package_groups',
|
||||
'old' => 'conv_pg_parent',
|
||||
'new' => 'pg_conv_parent'
|
||||
),
|
||||
array(
|
||||
'table' => 'nexus_packages',
|
||||
'old' => 'conv_p_associable',
|
||||
'new' => 'p_conv_associable'
|
||||
),
|
||||
array(
|
||||
'table' => 'nexus_purchases',
|
||||
'old' => 'conv_ps_parent',
|
||||
'new' => 'ps_conv_parent'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
foreach( $old AS $app => $tables )
|
||||
{
|
||||
foreach( $tables AS $data )
|
||||
{
|
||||
/* Does the table and old column exist? */
|
||||
if ( \IPS\Db::i()->checkForTable( $data['table'] ) AND \IPS\Db::i()->checkForColumn( $data['table'], $data['old'] ) )
|
||||
{
|
||||
/* Does the new column exist? */
|
||||
if ( \IPS\Db::i()->checkForColumn( $data['table'], $data['new'] ) )
|
||||
{
|
||||
/* Drop it */
|
||||
\IPS\Db::i()->dropColumn( $data['table'], $data['new'] );
|
||||
}
|
||||
|
||||
/* Alter the old one */
|
||||
\IPS\Db::i()->changeColumn( $data['table'], $data['old'], array(
|
||||
'name' => $data['new'],
|
||||
'type' => 'BIGINT',
|
||||
'length' => 20,
|
||||
'default' => 0
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"convert_logs",
|
||||
{
|
||||
"name": "log_item_id",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace IPS\convert\setup\upg_101006;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Adjust converter columns - we do it here to combine queries for efficiency
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( array(
|
||||
array(
|
||||
'table' => 'convert_link_posts',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "convert_link_posts CHANGE foreign_id foreign_id VARCHAR(255) NOT NULL DEFAULT '',
|
||||
ADD INDEX local_lookup(ipb_id,type,app),
|
||||
DROP INDEX foreign_id,
|
||||
ADD INDEX foreign_id (foreign_id(191)),
|
||||
DROP INDEX ipb_id,
|
||||
DROP INDEX `type`,
|
||||
ADD INDEX `type` (`type`),
|
||||
ADD INDEX app (app)"
|
||||
),
|
||||
array(
|
||||
'table' => 'convert_link_pms',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "convert_link_pms CHANGE foreign_id foreign_id VARCHAR(255) NOT NULL DEFAULT '',
|
||||
ADD INDEX local_lookup(ipb_id,type,app),
|
||||
DROP INDEX foreign_id,
|
||||
ADD INDEX foreign_id (foreign_id(191)),
|
||||
DROP INDEX ipb_id,
|
||||
DROP INDEX `type`,
|
||||
ADD INDEX `type` (`type`),
|
||||
ADD INDEX app (app)"
|
||||
),
|
||||
array(
|
||||
'table' => 'convert_link_topics',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "convert_link_topics CHANGE foreign_id foreign_id VARCHAR(255) NOT NULL DEFAULT '',
|
||||
ADD INDEX local_lookup(ipb_id,type,app),
|
||||
DROP INDEX foreign_id,
|
||||
ADD INDEX foreign_id (foreign_id(191)),
|
||||
DROP INDEX ipb_id,
|
||||
DROP INDEX `type`,
|
||||
ADD INDEX `type` (`type`),
|
||||
ADD INDEX app (app)"
|
||||
),
|
||||
array(
|
||||
'table' => 'convert_link',
|
||||
'query' => "ALTER TABLE " . \IPS\Db::i()->prefix . "convert_link CHANGE foreign_id foreign_id VARCHAR(255) NOT NULL DEFAULT '',
|
||||
ADD INDEX local_lookup(ipb_id,type,app),
|
||||
DROP INDEX foreign_id,
|
||||
ADD INDEX foreign_id (foreign_id(191)),
|
||||
DROP INDEX ipb_id,
|
||||
DROP INDEX `type`,
|
||||
ADD INDEX `type` (`type`),
|
||||
ADD INDEX app (app)"
|
||||
)
|
||||
) );
|
||||
|
||||
if ( \count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'convert', 'extra' => array( '_upgradeStep' => 2, '_upgradeData' => 0 ) ) );
|
||||
|
||||
/* Queries to run manually */
|
||||
return array( 'html' => \IPS\Theme::i()->getTemplate( 'forms' )->queries( $toRun, \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr_continue' => 1, 'mr' => \IPS\Request::i()->mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,438 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace IPS\convert\setup\upg_101007;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.4 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Rename or Create custom_bbcode and bbcode_mediatag
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
if ( !\IPS\Db::i()->checkForTable( 'convert_custom_bbcode' ) )
|
||||
{
|
||||
if ( \IPS\Db::i()->checkForTable( 'custom_bbcode' ) )
|
||||
{
|
||||
\IPS\Db::i()->renameTable( 'custom_bbcode', 'convert_custom_bbcode' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->createTable( array (
|
||||
'name' => 'convert_custom_bbcode',
|
||||
'columns' => array(
|
||||
'bbcode_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 10,
|
||||
'name' => 'bbcode_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_title' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_title',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array (),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_desc' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'bbcode_desc',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_tag' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_tag',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_replace' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'bbcode_replace',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_useoption' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 1,
|
||||
'name' => 'bbcode_useoption',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_example' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'bbcode_example',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_switch_option' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 1,
|
||||
'name' => 'bbcode_switch_option',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_menu_option_text' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 200,
|
||||
'name' => 'bbcode_menu_option_text',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_menu_content_text' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 200,
|
||||
'name' => 'bbcode_menu_content_text',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_single_tag' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 1,
|
||||
'name' => 'bbcode_single_tag',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_groups' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_groups',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_sections' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_sections',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_php_plugin' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_php_plugin',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_no_parsing' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 1,
|
||||
'name' => 'bbcode_no_parsing',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_protected' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 1,
|
||||
'name' => 'bbcode_protected',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_aliases' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_aliases',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_optional_option' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 1,
|
||||
'name' => 'bbcode_optional_option',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array (),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_image' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 255,
|
||||
'name' => 'bbcode_image',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_app' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 50,
|
||||
'name' => 'bbcode_app',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'bbcode_custom_regex' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'bbcode_custom_regex',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array(
|
||||
'type' => 'primary',
|
||||
'name' => 'PRIMARY',
|
||||
'length' => array( 0 => NULL ),
|
||||
'columns' => array( 0 => 'bbcode_id' ),
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !\IPS\Db::i()->checkForTable( 'convert_bbcode_mediatag' ) )
|
||||
{
|
||||
if ( \IPS\Db::i()->checkForTable( 'bbcode_mediatag' ) )
|
||||
{
|
||||
\IPS\Db::i()->renameTable( 'bbcode_mediatag', 'convert_bbcode_mediatag' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->createTable( array(
|
||||
'name' => 'convert_bbcode_mediatag',
|
||||
'columns' => array(
|
||||
'mediatag_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 10,
|
||||
'name' => 'mediatag_id',
|
||||
'type' => 'SMALLINT',
|
||||
'unsigned' => true,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'mediatag_name' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 255,
|
||||
'name' => 'mediatag_name',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'mediatag_match' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'mediatag_match',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'mediatag_replace' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'mediatag_replace',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'mediatag_position' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 6,
|
||||
'name' => 'mediatag_position',
|
||||
'type' => 'SMALLINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array(
|
||||
'type' => 'primary',
|
||||
'name' => 'PRIMARY',
|
||||
'length' => array( 0 => NULL ),
|
||||
'columns' => array( 0 => 'mediatag_id' ),
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"name": "db_port",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": false,
|
||||
"default": "3066",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
"db_port",
|
||||
{
|
||||
"name": "db_port",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": false,
|
||||
"default": "3306",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"db_port": 3306
|
||||
},
|
||||
[
|
||||
"db_port=?",
|
||||
3066
|
||||
]
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"convert_logs",
|
||||
{
|
||||
"name": "log_time",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Upgrader: Custom Post Upgrade Message
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 16 May 2016
|
||||
*/
|
||||
|
||||
/* Check for the older style redirect scripts, and if present tell the admin to remove. */
|
||||
$redirectScriptNames = array(
|
||||
'forumdisplay.php',
|
||||
'member.php',
|
||||
'showthread.php',
|
||||
'showgallery.php',
|
||||
'showphoto.php',
|
||||
'memberlist.php',
|
||||
'viewforum.php',
|
||||
'viewtopic.php',
|
||||
'board.php',
|
||||
'profile.php',
|
||||
'topic.php',
|
||||
'album.php',
|
||||
'attachment.php',
|
||||
'picture.php',
|
||||
'showpost.php',
|
||||
'showthread.php',
|
||||
'tags.php',
|
||||
'archive/index.php',
|
||||
'vb_gateway.php',
|
||||
'proxy.php'
|
||||
);
|
||||
|
||||
$filesPresent = array();
|
||||
|
||||
foreach( $redirectScriptNames as $filename )
|
||||
{
|
||||
if( file_exists( \IPS\ROOT_PATH . '/' . $filename ) )
|
||||
{
|
||||
$filesPresent[] = $filename;
|
||||
}
|
||||
}
|
||||
|
||||
if( \count( $filesPresent ) )
|
||||
{
|
||||
$message = <<<EOF
|
||||
<div class='ipsType_left'>The following files are present in your Community Suite root directory to handle redirects for a conversion, but are no longer needed and should be removed:
|
||||
<br><br>•
|
||||
EOF;
|
||||
|
||||
$message .= implode( "<br>• ", $filesPresent );
|
||||
|
||||
$message .= <<<EOF
|
||||
<br><br>
|
||||
Please also be sure that your .htaccess file is reset back to the default Community Suite .htaccess code. You can download the default .htaccess file for the Community Suite in the ACP under System -> Site Promotion -> Search Engine Optimization by clicking the link in the setting "Rewrite URLs?".
|
||||
</div>
|
||||
EOF;
|
||||
|
||||
$message = \IPS\Theme::i()->getTemplate( 'global' )->block( NULL, $message );
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"app_key": "vbulletin"
|
||||
},
|
||||
[
|
||||
"app_key=?",
|
||||
"vbuletin_legacy"
|
||||
]
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"app_key": "vbulletin"
|
||||
},
|
||||
[
|
||||
"app_key=?",
|
||||
"vbulletin_legacy36"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"app_key": "vbulletin"
|
||||
},
|
||||
[
|
||||
"app_key=?",
|
||||
"vbuletin_legacy"
|
||||
]
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"app_key": "vbulletin"
|
||||
},
|
||||
[
|
||||
"app_key=?",
|
||||
"vbulletin_legacy36"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"name": "finished",
|
||||
"type": "BIT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": true,
|
||||
"default": "0",
|
||||
"comment": "Has app been finished?",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
{
|
||||
"finished": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"core_applications",
|
||||
{
|
||||
"app_enabled": 1
|
||||
},
|
||||
[
|
||||
"app_directory=?",
|
||||
"convert"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.3.0 Beta 1 Upgrade Code
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 16 Oct 2017
|
||||
*/
|
||||
|
||||
namespace IPS\convert\setup\upg_103000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.3.0 Beta 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Install new login handler
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
/* Install new login handler */
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->select( '*', 'core_login_methods', array( "login_classname=?", 'IPS\\convert\\Login' ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$position = \IPS\Db::i()->select( 'MAX(login_order)', 'core_login_methods' )->first();
|
||||
|
||||
$handler = new \IPS\convert\Login;
|
||||
$handler->classname = 'IPS\\convert\\Login';
|
||||
$handler->order = $position + 1;
|
||||
$handler->acp = TRUE;
|
||||
$handler->settings = array( 'auth_types' => \IPS\Login::AUTH_TYPE_EMAIL );
|
||||
$handler->enabled = TRUE;
|
||||
$handler->register = FALSE;
|
||||
$handler->save();
|
||||
|
||||
\IPS\Lang::saveCustom( 'core', "login_method_{$handler->id}", 'Converter' );
|
||||
}
|
||||
|
||||
/* Remove legacy login handler */
|
||||
\IPS\Db::i()->delete( 'core_login_handlers', array( 'login_key=?', 'Convert' ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"convert_apps",
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.4.3 Beta 1 Upgrade Code
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Mar 2019
|
||||
*/
|
||||
|
||||
namespace IPS\convert\setup\upg_104021;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.4.3 Beta 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Update completed members.
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
/* If upgrading from 4.4.0 or earlier we don't need to do anything */
|
||||
if( \IPS\Application::load('core')->long_version < 104000 )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Get first upgrade date for versions since 4.4.0 */
|
||||
$firstUpgradeDate = (int) \IPS\Db::i()->select( 'MIN(upgrade_date)', 'core_upgrade_history', array( 'upgrade_app=? AND upgrade_version_id>=?', 'core', 104000 ) )->first();
|
||||
if( !$firstUpgradeDate )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$conversions = \IPS\Db::i()->select( 'COUNT(app_id)', 'convert_apps', array( 'start_date>=?', $firstUpgradeDate ) )->first();
|
||||
if( !$conversions )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( array(
|
||||
array(
|
||||
'table' => 'core_members',
|
||||
'query' => "UPDATE " . \IPS\Db::i()->prefix . "core_members SET completed=1 WHERE name != '' and name IS NOT NULL and email != '' and email IS NOT NULL"
|
||||
)
|
||||
) );
|
||||
|
||||
if ( \count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'convert', 'extra' => array( '_upgradeStep' => 2 ) ) );
|
||||
|
||||
/* Queries to run manually */
|
||||
return array( 'html' => \IPS\Theme::i()->getTemplate( 'forms' )->queries( $toRun, \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr_continue' => 1, 'mr' => \IPS\Request::i()->mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1ustomTitle()
|
||||
{
|
||||
return "Adjusting members table";
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107702,
|
||||
"name": "4.7.12 Beta 3",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107748,
|
||||
"name": "4.7.16",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107750,
|
||||
"name": "4.7.16",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107751,
|
||||
"name": "4.7.16",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107760,
|
||||
"name": "4.7.17 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107774,
|
||||
"name": "4.7.18",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107775,
|
||||
"name": "4.7.18",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107780,
|
||||
"name": "4.7.19 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107781,
|
||||
"name": "4.7.19 Beta 2",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107782,
|
||||
"name": "4.7.19 Beta 3",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107783,
|
||||
"name": "4.7.19 Beta 4",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107784,
|
||||
"name": "4.7.19",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107785,
|
||||
"name": "4.7.19",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107786,
|
||||
"name": "4.7.19",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107787,
|
||||
"name": "4.7.19",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107795,
|
||||
"name": "4.7.20 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107796,
|
||||
"name": "4.7.20 Beta 2",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107797,
|
||||
"name": "4.7.20 Beta 3",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107798,
|
||||
"name": "4.7.20 Beta 4",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107799,
|
||||
"name": "4.7.20 Beta 5",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107800,
|
||||
"name": "4.7.20",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107801,
|
||||
"name": "4.7.20",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107802,
|
||||
"name": "4.7.20",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107810,
|
||||
"name": "4.7.21 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107811,
|
||||
"name": "4.7.21",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107815,
|
||||
"name": "4.7.22 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107816,
|
||||
"name": "4.7.22 Beta 2",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107817,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107818,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107819,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107820,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107826,
|
||||
"name": "4.7.23 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"id": 107827,
|
||||
"name": "4.7.23",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,337 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 1.2.3 Upgrade Code
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 01 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\convert\setup\upg_33001;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1.2.3 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Create extra conv_link tables
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
if ( !\IPS\Db::i()->checkForTable( 'conv_link_pms' ) )
|
||||
{
|
||||
\IPS\Db::i()->createTable( array (
|
||||
'name' => 'conv_link_pms',
|
||||
'columns' => array(
|
||||
'link_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 10,
|
||||
'name' => 'link_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'ipb_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'ipb_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'foreign_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'foreign_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'type' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 32,
|
||||
'name' => 'type',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'duplicate' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 1,
|
||||
'name' => 'duplicate',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'app' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'app',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array(
|
||||
'type' => 'primary',
|
||||
'name' => 'PRIMARY',
|
||||
'length' => array( 0 => NULL ),
|
||||
'columns' => array( 0 => 'link_id' ),
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
if ( !\IPS\Db::i()->checkForTable( 'conv_link_topics' ) )
|
||||
{
|
||||
\IPS\Db::i()->createTable( array (
|
||||
'name' => 'conv_link_topics',
|
||||
'columns' => array(
|
||||
'link_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 10,
|
||||
'name' => 'link_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'ipb_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'ipb_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'foreign_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'foreign_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'type' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 32,
|
||||
'name' => 'type',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'duplicate' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 1,
|
||||
'name' => 'duplicate',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'app' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'app',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array(
|
||||
'type' => 'primary',
|
||||
'name' => 'PRIMARY',
|
||||
'length' => array( 0 => NULL ),
|
||||
'columns' => array( 0 => 'link_id' ),
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
if ( !\IPS\Db::i()->checkForTable( 'conv_link_posts' ) )
|
||||
{
|
||||
\IPS\Db::i()->createTable( array (
|
||||
'name' => 'conv_link_posts',
|
||||
'columns' => array(
|
||||
'link_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 10,
|
||||
'name' => 'link_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'ipb_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'ipb_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'foreign_id' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'foreign_id',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'type' => array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 32,
|
||||
'name' => 'type',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'duplicate' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 1,
|
||||
'name' => 'duplicate',
|
||||
'type' => 'TINYINT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'app' => array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => 0,
|
||||
'length' => 10,
|
||||
'name' => 'app',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array(
|
||||
'type' => 'primary',
|
||||
'name' => 'PRIMARY',
|
||||
'length' => array( 0 => NULL ),
|
||||
'columns' => array( 0 => 'link_id' ),
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"id": 107745,
|
||||
"name": "4.7.16",
|
||||
"id": 5000003,
|
||||
"name": "5.0.0 Alpha 3",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"id": 107722,
|
||||
"name": "4.7.14",
|
||||
"id": 5000004,
|
||||
"name": "5.0.0 Alpha 4",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"id": 107746,
|
||||
"name": "4.7.16",
|
||||
"id": 5000005,
|
||||
"name": "5.0.0 Alpha 5",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"id": 107747,
|
||||
"name": "4.7.16",
|
||||
"id": 5000006,
|
||||
"name": "5.0.0 Alpha 5",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"id": 5000007,
|
||||
"name": "5.0.0 Alpha 5",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
Loaded 100 of 6736 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user