This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 
<?php defined('C5_EXECUTE') or die("Access Denied.");

class ConcreteUpgradeVersion5633Helper {

    public $dbRefreshTables = array(
        'QueueMessages'
    );

    public function run() {
        if (!ENABLE_USER_PROFILES) {
            $membersPage = Page::getByPath('/members');
            if ($membersPage instanceof Page && !$membersPage->isError()) {
                $membersPage->delete();
            }
        }
        
        // Update robots.txt
        
        $delete_rules = array(
            'Disallow: /blocks',
            'Disallow: /concrete',
            'Disallow: /css',
            'Disallow: /js',
            'Disallow: /themes',
            'Disallow: /packages',
            'Disallow: /updates'
        );
        
        $add_rules = array(
            'Disallow: /blocks/*.php$',
            'Disallow: /blocks/*.xml$',
            'Disallow: /concrete/*.php$',
            'Disallow: /concrete/*.xml$',
            'Disallow: /packages/*.php$',
            'Disallow: /packages/*.xml$',
            'Disallow: /updates/*.php$',
            'Disallow: /updates/*.xml$'
        );
        
        $robotspath = DIR_BASE . '/robots.txt';
        $fh = Loader::helper('file');
        
        if (file_exists($robotspath) && is_writable($robotspath)) {
            $rules = array();
            
            $robotstxt = @file($robotspath, FILE_IGNORE_NEW_LINES);
            foreach ($robotstxt as $line) {
                $line = trim($line);
                if (!in_array($line, $delete_rules)) {
                    $rules[] = $line;
                }
            }
            
            $new_rules = array_merge($rules, $add_rules);
            $new_robotstxt = implode("\n", $new_rules);
            
            $fh->clear($robotspath);
            $fh->append($robotspath, $new_robotstxt);
        }
    }

}