Giter Site home page Giter Site logo

magento-cleanup's Introduction

Toby Osbourn - Ruby on Rails developer and interim CTO

Hey there, I'm Toby ๐Ÿ‘‹, I do a mixture of Ruby on Rails development and interim CTO-ing.

I write about all of that stuff an more across the internet;

The best way to contact me is through my business website, tosbourn.com. I'm happy to chat about all things relating to web development.

magento-cleanup's People

Contributors

tosbourn avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

magento-cleanup's Issues

Combined

This is what we made of it, but I must say it finishes so quick that I am not sure i it actually works.

Let me know if this helps

global->resources->default_setup->connection->host; $db['name'] = $xml->global->resources->default_setup->connection->dbname; $db['user'] = $xml->global->resources->default_setup->connection->username; $db['pass'] = $xml->global->resources->default_setup->connection->password; $db['pref'] = $xml->global->resources->db->table_prefix; if($_GET['clean'] == 'log') clean_log_tables(); if($_GET['clean'] == 'var') clean_var_directory(); echo "----------------------- CLEANUP START -------------------------
"; $start = (float) array_sum(explode(' ',microtime())); echo "
**************\* SETTING PERMISSIONS ***************
"; clean_log_tables(); clean_var_directory(); $end = (float) array_sum(explode(' ',microtime())); echo "
------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------
"; function clean_log_tables() { global $db; ``` $tables = array( 'dataflow_batch_export', 'dataflow_batch_import', 'log_customer', 'log_quote', 'log_summary', 'log_summary_type', 'log_url', 'log_url_info', 'log_visitor', 'log_visitor_info', 'log_visitor_online', 'index_event', 'report_event', 'report_compared_product_index', 'report_viewed_product_index', 'catalog_compare_item', 'catalogindex_aggregation', 'catalogindex_aggregation_tag', 'catalogindex_aggregation_to_tag' ); mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error()); mysql_select_db($db['name']) or die(mysql_error()); foreach($tables as $v => $k) { @mysql_query('TRUNCATE `'.$db['pref'].$k.'`'); echo "Cleaned table: $k
"; flush(); } ``` } ## Function to clean out the contents of specified directory function cleandir($dir) { ``` if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) { if (unlink($dir.'/'.$file)) { } else { echo $dir . '/' . $file . ' (file) NOT deleted!
'; } } else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) { cleandir($dir.'/'.$file); if (rmdir($dir.'/'.$file)) { } else { echo $dir . '/' . $file . ' (directory) NOT deleted!
'; } } } closedir($handle); } ``` } function clean_var_directory() { $dirs = array( 'downloader/.cache/_', 'downloader/pearlib/cache/_', 'downloader/pearlib/download/*', 'var/cache/', 'var/locks/', 'var/log/', 'var/report/', 'var/session/', 'var/import/', 'var/export/', 'var/tmp/' ); ``` foreach($dirs as $v => $k) { # exec('rm -rf '.$k); cleandir($k); echo "Cleaned directory: $k
"; flush(); } ``` } ?>

Dependabot couldn't find a composer.json for this project

Dependabot couldn't find a composer.json for this project.

Dependabot requires a composer.json to evaluate your project's current PHP dependencies. It had expected to find one at the path: /composer.json.

If this isn't a PHP project, or if it is a library, you may wish to disable updates for it from within Dependabot.

You can mention @dependabot in the comments below to contact the Dependabot team.

Exec not working

Is it possible to add a version that tests if exec is enabled

If not that it uses something like this:

function cleandir($dir) {

if ($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {
            if (unlink($dir.'/'.$file)) { }
            else { echo $dir . '/' . $file . ' (file) NOT deleted!<br />'; }
        }
        else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) {
            cleandir($dir.'/'.$file);
            if (rmdir($dir.'/'.$file)) { }
            else { echo $dir . '/' . $file . ' (directory) NOT deleted!<br />'; }
        }
    }
    closedir($handle);
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.