Current oav website
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceCache extends dcMaintenanceTask
|
||||
{
|
||||
protected $group = 'purge';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->task = __('Empty templates cache directory');
|
||||
$this->success = __('Templates cache directory emptied.');
|
||||
$this->error = __('Failed to empty templates cache directory.');
|
||||
|
||||
$this->description = __("It may be useful to empty this cache when modifying a theme's .html or .css files (or when updating a theme or plugin). Notice : with some hosters, the templates cache cannot be emptied with this plugin. You may then have to delete the directory <strong>/cbtpl/</strong> directly on the server with your FTP software.");
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$this->core->emptyTemplatesCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceCountcomments extends dcMaintenanceTask
|
||||
{
|
||||
protected $group = 'index';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->task = __('Count again comments and trackbacks');
|
||||
$this->success = __('Comments and trackback counted.');
|
||||
$this->error = __('Failed to count comments and trackbacks.');
|
||||
|
||||
$this->description = __('Count again comments and trackbacks allows to check their exact numbers. This operation can be useful when importing from another blog platform (or when migrating from dotclear 1 to dotclear 2).');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$this->core->countAllComments();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceCSP extends dcMaintenanceTask
|
||||
{
|
||||
protected $group = 'purge';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->task = __('Delete the Content-Security-Policy report file');
|
||||
$this->success = __('Content-Security-Policy report file has been deleted.');
|
||||
$this->error = __('Failed to delete the Content-Security-Policy report file.');
|
||||
|
||||
$this->description = __("Remove the Content-Security-Policy report file.");
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$csp_file = path::real(DC_VAR) . '/csp/csp_report.json';
|
||||
if (file_exists($csp_file)) {
|
||||
unlink($csp_file);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceIndexcomments extends dcMaintenanceTask
|
||||
{
|
||||
protected $ajax = true;
|
||||
protected $group = 'index';
|
||||
protected $limit = 500;
|
||||
protected $step_task;
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->name = __('Search engine index');
|
||||
$this->task = __('Index all comments for search engine');
|
||||
$this->step_task = __('Next');
|
||||
$this->step = __('Indexing comment %d to %d.');
|
||||
$this->success = __('Comments index done.');
|
||||
$this->error = __('Failed to index comments.');
|
||||
|
||||
$this->description = __('Index all comments and trackbacks in search engine index. This operation is necessary, after importing content in your blog, to use internal search engine, on public and private pages.');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$this->code = $this->core->indexAllComments($this->code, $this->limit);
|
||||
|
||||
return $this->code ?: true;
|
||||
}
|
||||
|
||||
public function task()
|
||||
{
|
||||
return $this->code ? $this->step_task : $this->task;
|
||||
}
|
||||
|
||||
public function step()
|
||||
{
|
||||
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null;
|
||||
}
|
||||
|
||||
public function success()
|
||||
{
|
||||
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceIndexposts extends dcMaintenanceTask
|
||||
{
|
||||
protected $ajax = true;
|
||||
protected $group = 'index';
|
||||
protected $limit = 500;
|
||||
protected $step_task;
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->name = __('Search engine index');
|
||||
$this->task = __('Index all entries for search engine');
|
||||
$this->step_task = __('Next');
|
||||
$this->step = __('Indexing entry %d to %d.');
|
||||
$this->success = __('Entries index done.');
|
||||
$this->error = __('Failed to index entries.');
|
||||
|
||||
$this->description = __('Index all entries in search engine index. This operation is necessary, after importing content in your blog, to use internal search engine, on public and private pages.');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$this->code = $this->core->indexAllPosts($this->code, $this->limit);
|
||||
|
||||
return $this->code ?: true;
|
||||
}
|
||||
|
||||
public function task()
|
||||
{
|
||||
return $this->code ? $this->step_task : $this->task;
|
||||
}
|
||||
|
||||
public function step()
|
||||
{
|
||||
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null;
|
||||
}
|
||||
|
||||
public function success()
|
||||
{
|
||||
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceLogs extends dcMaintenanceTask
|
||||
{
|
||||
public static $keep_maintenance_logs = true;
|
||||
|
||||
protected $group = 'purge';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->task = __('Delete all logs');
|
||||
$this->success = __('Logs deleted.');
|
||||
$this->error = __('Failed to delete logs.');
|
||||
|
||||
$this->description = __('Logs record all activity and connection to your blog history. Unless you need to keep this history, consider deleting these logs from time to time.');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
if (dcMaintenanceLogs::$keep_maintenance_logs) {
|
||||
$this->core->con->execute(
|
||||
'DELETE FROM ' . $this->core->prefix . 'log ' .
|
||||
"WHERE log_table <> 'maintenance' "
|
||||
);
|
||||
} else {
|
||||
$this->core->log->delLogs(null, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceSynchpostsmeta extends dcMaintenanceTask
|
||||
{
|
||||
protected $ajax = true;
|
||||
protected $group = 'index';
|
||||
protected $limit = 100;
|
||||
protected $step_task;
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->name = __('Entries metadata');
|
||||
$this->task = __('Synchronize entries metadata');
|
||||
$this->step_task = __('Next');
|
||||
$this->step = __('Synchronize entry %d to %d.');
|
||||
$this->success = __('Entries metadata synchronize done.');
|
||||
$this->error = __('Failed to synchronize entries metadata.');
|
||||
|
||||
$this->description = __('Synchronize all entries metadata could be useful after importing content in your blog or do bad operation on database tables.');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$this->code = $this->synchronizeAllPostsmeta($this->code, $this->limit);
|
||||
|
||||
return $this->code ?: true;
|
||||
}
|
||||
|
||||
public function task()
|
||||
{
|
||||
return $this->code ? $this->step_task : $this->task;
|
||||
}
|
||||
|
||||
public function step()
|
||||
{
|
||||
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null;
|
||||
}
|
||||
|
||||
public function success()
|
||||
{
|
||||
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success;
|
||||
}
|
||||
|
||||
protected function synchronizeAllPostsmeta($start = null, $limit = null)
|
||||
{
|
||||
// Get number of posts
|
||||
$rs = $this->core->con->select('SELECT COUNT(post_id) FROM ' . $this->core->prefix . 'post');
|
||||
$count = $rs->f(0);
|
||||
|
||||
// Get posts ids to update
|
||||
$req_limit = $start !== null && $limit !== null ? $this->core->con->limit($start, $limit) : '';
|
||||
$rs = $this->core->con->select('SELECT post_id FROM ' . $this->core->prefix . 'post ' . $req_limit, true);
|
||||
|
||||
// Update posts meta
|
||||
while ($rs->fetch()) {
|
||||
$rs_meta = $this->core->con->select('SELECT meta_id, meta_type FROM ' . $this->core->prefix . 'meta WHERE post_id = ' . $rs->post_id . ' ');
|
||||
|
||||
$meta = array();
|
||||
while ($rs_meta->fetch()) {
|
||||
$meta[$rs_meta->meta_type][] = $rs_meta->meta_id;
|
||||
}
|
||||
|
||||
$cur = $this->core->con->openCursor($this->core->prefix . 'post');
|
||||
$cur->post_meta = serialize($meta);
|
||||
$cur->update('WHERE post_id = ' . $rs->post_id);
|
||||
}
|
||||
$this->core->blog->triggerBlog();
|
||||
|
||||
// Return next step
|
||||
return $start + $limit > $count ? null : $start + $limit;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceVacuum extends dcMaintenanceTask
|
||||
{
|
||||
protected $group = 'optimize';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->name = __('Optimise database');
|
||||
$this->task = __('optimize tables');
|
||||
$this->success = __('Optimization successful.');
|
||||
$this->error = __('Failed to optimize tables.');
|
||||
|
||||
$this->description = __("After numerous delete or update operations on Dotclear's database, it gets fragmented. Optimizing will allow to defragment it. It has no incidence on your data's integrity. It is recommended to optimize before any blog export.");
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$schema = dbSchema::init($this->core->con);
|
||||
|
||||
foreach ($schema->getTables() as $table) {
|
||||
if (strpos($table, $this->core->prefix) === 0) {
|
||||
$this->core->con->vacuum($table);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceZipmedia extends dcMaintenanceTask
|
||||
{
|
||||
protected $perm = 'admin';
|
||||
protected $blog = true;
|
||||
protected $tab = 'backup';
|
||||
protected $group = 'zipblog';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->task = __('Download media folder of current blog');
|
||||
|
||||
$this->description = __('It may be useful to backup your media folder. This compress all content of media folder into a single zip file. Notice : with some hosters, the media folder cannot be compressed with this plugin if it is too big.');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
// Instance media
|
||||
$this->core->media = new dcMedia($this->core);
|
||||
$this->core->media->chdir(null);
|
||||
$this->core->media->getDir();
|
||||
|
||||
// Create zip
|
||||
@set_time_limit(300);
|
||||
$fp = fopen('php://output', 'wb');
|
||||
$zip = new fileZip($fp);
|
||||
$zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');
|
||||
$zip->addDirectory($this->core->media->root . '/', '', true);
|
||||
|
||||
// Log task execution here as we sent file and stop script
|
||||
$this->log();
|
||||
|
||||
// Send zip
|
||||
header('Content-Disposition: attachment;filename=' . date('Y-m-d') . '-' . $this->core->blog->id . '-' . 'media.zip');
|
||||
header('Content-Type: application/x-zip');
|
||||
$zip->write();
|
||||
unset($zip);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief maintenance, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugins
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
|
||||
class dcMaintenanceZiptheme extends dcMaintenanceTask
|
||||
{
|
||||
protected $perm = 'admin';
|
||||
protected $blog = true;
|
||||
protected $tab = 'backup';
|
||||
protected $group = 'zipblog';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->task = __('Download active theme of current blog');
|
||||
|
||||
$this->description = __('It may be useful to backup the active theme before any change or update. This compress theme folder into a single zip file.');
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
// Get theme path
|
||||
$path = $this->core->blog->themes_path;
|
||||
$theme = $this->core->blog->settings->system->theme;
|
||||
$dir = path::real($path . '/' . $theme);
|
||||
if (empty($path) || empty($theme) || !is_dir($dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create zip
|
||||
@set_time_limit(300);
|
||||
$fp = fopen('php://output', 'wb');
|
||||
$zip = new fileZip($fp);
|
||||
$zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');
|
||||
$zip->addDirectory($dir . '/', '', true);
|
||||
|
||||
// Log task execution here as we sent file and stop script
|
||||
$this->log();
|
||||
|
||||
// Send zip
|
||||
header('Content-Disposition: attachment;filename=theme-' . $theme . '.zip');
|
||||
header('Content-Type: application/x-zip');
|
||||
$zip->write();
|
||||
unset($zip);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user