[wp-trac] [WordPress Trac] #46313: WordPress 5.1 and $themes backward compatibility break-ish

WordPress Trac noreply at wordpress.org
Thu Mar 7 16:37:22 UTC 2019


#46313: WordPress 5.1 and $themes backward compatibility break-ish
--------------------------+----------------------
 Reporter:  flexithemes   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Themes        |     Version:  5.1
 Severity:  normal        |  Resolution:  wontfix
 Keywords:                |     Focuses:
--------------------------+----------------------

Comment (by flexithemes):

 @AppleBag I can't speak for other theme companies, but in our situation we
 created a small script that renamed the variable.

 {{{#!php
 <?php

         function create_edit_file($file, $content) {
           $fp = fopen($file, 'w');
           fwrite($fp, $content);
           fclose($fp);

           return true;
         }

         function replaceInExact($file, $searchfor, $replacewith) {
           $get_file = file_get_contents($file);
           if ($save_content = str_replace($searchfor, $replacewith,
 $get_file)) {
                 create_edit_file($file, $save_content);
           }

           return true;
         }

         function wp51update_files($folder) {
                 if ($handle = opendir($folder)) {
                         while (false !== ($file = readdir($handle))) {
                                 if ($file != '.' && $file != '..' && $file
 != 'Thumbs.db'  ) {
                                   if (is_dir($folder . '/' . $file ) ) {
                                         wp51update_files( $folder . '/' .
 $file );
                                   } elseif( substr_count($file, '.php') >
 0 )  {
                                         replaceInExact($folder . '/' .
 $file, '$theme', '$flexitheme');
                                   }
                                 }
                         }
                         closedir($handle);
                 }
         }

         $folder = './';

         wp51update_files($folder);

         echo "Sweet! Everything updated fine and your site should be
 working now!";
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46313#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list