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,16 +12,27 @@
|
||||
namespace IPS\convert\Software\Gallery;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\convert\Software;
|
||||
use IPS\Db;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task;
|
||||
use function defined;
|
||||
use function strtotime;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coppermine Gallery Converter
|
||||
*/
|
||||
class _Coppermine extends \IPS\convert\Software
|
||||
class Coppermine extends Software
|
||||
{
|
||||
/**
|
||||
* Software Name
|
||||
@@ -108,7 +119,7 @@ class _Coppermine extends \IPS\convert\Software
|
||||
{
|
||||
case 'convertGalleryAlbums':
|
||||
$options = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'gallery_categories' ), 'IPS\gallery\Category' ) AS $category )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'gallery_categories' ), 'IPS\gallery\Category' ) AS $category )
|
||||
{
|
||||
$options[$category->_id] = $category->_title;
|
||||
}
|
||||
@@ -129,8 +140,8 @@ class _Coppermine extends \IPS\convert\Software
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack( 'convert_coppermine_filehint' ),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
'field_hint' => Member::loggedIn()->language()->addToStack( 'convert_coppermine_filehint' ),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -146,14 +157,14 @@ class _Coppermine extends \IPS\convert\Software
|
||||
public function finish()
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
/* Caches */
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'gallery_images', 'class' => 'IPS\gallery\Image' ), 3, array( 'app', 'link', 'class' ) );
|
||||
Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'gallery_images', 'class' => 'IPS\gallery\Image' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( "f_gallery_images_rebuild", "f_gallery_cat_recount", "f_gallery_album_recount", "f_gallery_image_recount", "f_image_tags_recount" );
|
||||
}
|
||||
@@ -213,7 +224,7 @@ class _Coppermine extends \IPS\convert\Software
|
||||
{
|
||||
$this->app->getLink( $row['category'], 'gallery_categories' );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$category = $this->app->_session['more_info']['convertGalleryAlbums']['members_gallery_category'];
|
||||
if ( $category == 0 )
|
||||
@@ -249,7 +260,7 @@ class _Coppermine extends \IPS\convert\Software
|
||||
'image_description' => $row['caption'],
|
||||
'image_views' => $row['hits'],
|
||||
'image_date' => $row['ctime'],
|
||||
'image_updated' => \strtotime( $row['mtime'] ),
|
||||
'image_updated' => strtotime( $row['mtime'] ),
|
||||
'image_ipaddress' => $row['pic_raw_ip'],
|
||||
'image_file_name' => $row['filename']
|
||||
);
|
||||
@@ -307,7 +318,7 @@ class _Coppermine extends \IPS\convert\Software
|
||||
'comment_author_id' => $row['author_id'],
|
||||
'comment_author_name' => $row['msg_author'],
|
||||
'comment_ip_address' => $row['msg_raw_ip'],
|
||||
'comment_post_date' => \strtotime( $row['msg_date'] ),
|
||||
'comment_post_date' => strtotime( $row['msg_date'] ),
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['msg_id'] );
|
||||
|
||||
Reference in new issue
Block a user