auto integrity/optimize on daily trigger

soaringeagle
@soaringeagle
10 years ago
3,304 posts
would love an option to auto run the integrity check on the daily maintenance trigger, maybe add as second set of checkboxes that allow you to select wich options auto run during the daily maintenance .. like skipping the module and skin verification but clearing cache repairing and optimizing tables, or doing the full list each night as an automatic maintenance tuneup



--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities

updated by @soaringeagle: 08/05/15 06:31:31AM
michael
@michael
10 years ago
7,750 posts
There already is a process that runs daily that does maintenance stuff. Its called "Daily Maintenance" and has a listener if you really wanted to fire the full integrity check.

There is an event that fires for it:
'daily_maintenance'

"Events and Listeners"
https://www.jamroom.net/the-jamroom-network/documentation/development/1011/events-and-listeners

Lots of modules do cleanup on that event, eg:
jrBackup_daily_maintenance_listener
jrCharts_daily_maintenance_listener
jrCloudConversionServer_daily_maintenance_listener
jrCore_daily_maintenance_listener
jrFlickr_daily_maintenance_listener
jrFoxyCart_daily_maintenance_listener
jrImage_daily_maintenance_listener
jrKickbox_daily_maintenance_listener
jrMailer_daily_maintenance_listener
.....

Are all fired once a day on that 'daily_maintenance' event and do whatever clean up is necessary for those modules.
soaringeagle
@soaringeagle
10 years ago
3,304 posts
right, but what im suggesting is there could be a 'auto run integrity check" option built into the integrity check that enables it to run in that maintenance cycle

or how would i go about getting the integrity check to fire at that time when thatlistener goes off and, have it enable all or some of the options selectively

id want to use all options, but i found when i have mod_pagespeed enabled the verify modules locks up; on jrforums so i had to disable pagespeed (wich drasticky reduced server load but increased load times significantly ( but still in the acceptable range)

i might instead see if i can run mysqlcheck as a cron job to repair all tables nightly and optimize all tables every 6 hours or something

that might be a better idea since it will optimize akll databases on all sites


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
michael
@michael
10 years ago
7,750 posts
What would be a better option is to add your own module and add your own 'daily_maintenance' listener then just do whatever you want to do without needing to run the integrity check.

The whole module only needs an include.php file, here it is here:
<?php
/**
 * @copyright You at wherever
 */

// make sure we are not being called directly
defined('APP_DIR') or exit();

/**
 * meta
 */
function xxSomething_meta(){
    $_tmp = array(
        'name'        => 'Something',
        'url'         => 'something',
        'version'     => '1.0.0',
        'developer'   => 'Nobody, &copy;' . strftime('%Y'),
        'description' => 'A module created to do somthing',
        'license'     => 'mpl',
        'category'    => 'site'
    );
    return $_tmp;
}

/**
 * init
 */
function xxSomething_init(){
    jrCore_register_event_listener('jrCore', 'daily_maintenance', 'xxSomething_daily_maintenance_listener');
    return true;
}


/**
 * xxSomething_daily_maintenance_listener
 * @param $_data array incoming data array from jrCore_save_media_file()
 * @param $_user array current user info
 * @param $_conf array Global config
 * @param $_args array additional info about the module
 * @param $event string Event Trigger name
 * @return array
 */
function xxSomething_daily_maintenance_listener($_data, $_user, $_conf, $_args, $event)
{ // do whatever you want to here...... return $_data; }

That would fire ever day at daily maintenance time.
soaringeagle
@soaringeagle
10 years ago
3,304 posts
ok i got ya, though since my main concerns optimizing the database ,running as a cron every 6 hours is working
i did crontab -e
added
0 6,12,18,23 * * * mysqlcheck --auto-repair --optimize --all-databases > /dev/nul 2>&1

so fsr seems to get the job done


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities

Tags