| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace SymphonyCms\Installer\Migrations; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | use SymphonyCms\Installer\Lib\Migration; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Symphony; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | class migration_233 extends Migration | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |     public static function getVersion() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |         return '2.3.3'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     public static function getReleaseNotes() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         return 'http://getsymphony.com/download/releases/version/2.3.3/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     public static function upgrade() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     { | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 21 |  | View Code Duplication |         if (version_compare(self::$existing_version, '2.3.3beta1', '<=')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |             // Update DB for the new author role #1692 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |             Symphony::Database()->query( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |                 "ALTER TABLE `tbl_authors` CHANGE `user_type` `user_type` ENUM('author', 'manager', 'developer') DEFAULT 'author'" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |             // Remove directory from the upload fields, #1719 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |             $upload_tables = Symphony::Database()->fetchCol( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |                 "field_id", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |                 "SELECT `field_id` FROM `tbl_fields_upload`" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |             if (is_array($upload_tables) && !empty($upload_tables)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |                 foreach ($upload_tables as $field) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |                     Symphony::Database()->query(sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |                         "UPDATE tbl_entries_data_%d SET FILE = substring_index(FILE, '/', -1)", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |                         $field | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |                     )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         if (version_compare(self::$existing_version, '2.3.3beta2', '<=')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             // Update rows for associations | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             if (!Symphony::Configuration()->get('association_maximum_rows', 'symphony')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |                 Symphony::Configuration()->set('association_maximum_rows', '5', 'symphony'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         // Update the version information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         return parent::upgrade(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |     public static function preUpdateNotes() | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |         return array( | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |             __("On update, all files paths will be removed from the core Upload field entry tables. If you are using an Upload field extension, ensure that the extension is compatible with this release before continuing.") | 
            
                                                        
            
                                    
            
            
                | 58 |  |  |         ); | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 60 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |  |