use latest dotclear namespace (database)
This commit is contained in:
parent
9b6ea2294c
commit
9adb197b2f
2 changed files with 16 additions and 16 deletions
|
@ -14,9 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Dotclear\Plugin\filesAlias;
|
||||
|
||||
use dbStruct;
|
||||
use dcCore;
|
||||
use dcNsProcess;
|
||||
use Dotclear\Database\Structure;
|
||||
use Exception;
|
||||
|
||||
class Install extends dcNsProcess
|
||||
|
@ -35,21 +35,21 @@ class Install extends dcNsProcess
|
|||
}
|
||||
|
||||
try {
|
||||
$s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||
$s = new Structure(dcCore::app()->con, dcCore::app()->prefix);
|
||||
|
||||
$s->{My::ALIAS_TABLE_NAME}
|
||||
->blog_id('varchar', 32, false)
|
||||
->filesalias_url('varchar', 255, false)
|
||||
->filesalias_destination('varchar', 255, false)
|
||||
->filesalias_password('varchar', 32, true, null)
|
||||
->filesalias_disposable('smallint', 0, false, 0)
|
||||
$s->__get(My::ALIAS_TABLE_NAME)
|
||||
->field('blog_id', 'varchar', 32, false)
|
||||
->field('filesalias_url', 'varchar', 255, false)
|
||||
->field('ilesalias_destination', 'varchar', 255, false)
|
||||
->field('filesalias_password', 'varchar', 32, true, null)
|
||||
->field('filesalias_disposable', 'smallint', 0, false, 0)
|
||||
|
||||
->primary('pk_filesalias', 'blog_id', 'filesalias_url')
|
||||
->index('idx_filesalias_blog_id', 'btree', 'blog_id')
|
||||
->reference('fk_filesalias_blog', 'blog_id', 'blog', 'blog_id', 'cascade', 'cascade')
|
||||
;
|
||||
|
||||
$si = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||
$si = new Structure(dcCore::app()->con, dcCore::app()->prefix);
|
||||
$changes = $si->synchronize($s);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Dotclear\Plugin\filesAlias;
|
|||
|
||||
use dcCore;
|
||||
use dcMedia;
|
||||
use dcRecord;
|
||||
use Dotclear\Database\MetaRecord;
|
||||
use Dotclear\Database\Statement\{
|
||||
DeleteStatement,
|
||||
SelectStatement
|
||||
|
@ -31,9 +31,9 @@ class Utils
|
|||
/**
|
||||
* Get aliases records.
|
||||
*
|
||||
* @return dcRecord The file alias records
|
||||
* @return MetaRecord The file alias records
|
||||
*/
|
||||
public static function getAliases(): dcRecord
|
||||
public static function getAliases(): MetaRecord
|
||||
{
|
||||
// nullsafe
|
||||
$blog_id = is_null(dcCore::app()->blog) ? '' : dcCore::app()->blog->id;
|
||||
|
@ -50,15 +50,15 @@ class Utils
|
|||
->order('filesalias_url ASC')
|
||||
->select();
|
||||
|
||||
return is_null($rs) ? dcRecord::newFromArray([]) : $rs;
|
||||
return is_null($rs) ? MetaRecord::newFromArray([]) : $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get alias record.
|
||||
*
|
||||
* @return dcRecord The alias record
|
||||
* @return MetaRecord The alias record
|
||||
*/
|
||||
public static function getAlias(string $url): dcRecord
|
||||
public static function getAlias(string $url): MetaRecord
|
||||
{
|
||||
// nullsafe
|
||||
$blog_id = is_null(dcCore::app()->blog) ? '' : dcCore::app()->blog->id;
|
||||
|
@ -76,7 +76,7 @@ class Utils
|
|||
->order('filesalias_url ASC')
|
||||
->select();
|
||||
|
||||
return is_null($rs) ? dcRecord::newFromArray([]) : $rs;
|
||||
return is_null($rs) ? MetaRecord::newFromArray([]) : $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue