@@ -111,55 +111,25 @@ public function get_errors()
111111 }
112112
113113 // Extensions
114- if (!extension_loaded ('session ' )) {
115- $ errors [] = 'Error: PHP session extension not activated ' ;
116- }
117- if (!extension_loaded ('exif ' )) {
118- $ errors [] = 'Error: PHP exif extension not activated ' ;
119- }
120- if (!extension_loaded ('mbstring ' )) {
121- $ errors [] = 'Error: PHP mbstring extension not activated ' ;
122- }
123- if (!extension_loaded ('gd ' )) {
124- $ errors [] = 'Error: PHP gd extension not activated ' ;
125- }
126- if (!extension_loaded ('PDO ' )) {
127- $ errors [] = 'Error: PHP PDO extension not activated ' ;
114+ $ extensions = ['session ' , 'exif ' , 'mbstring ' , 'gd ' , 'PDO ' , 'json ' , 'zip ' ];
115+
116+ foreach ($ extensions as $ extension ) {
117+ if (!extension_loaded ($ extension )) {
118+ $ errors [] = 'Error: PHP ' . $ extension . ' extension not activated ' ;
119+ }
128120 }
129121 if (!extension_loaded ('mysqli ' ) && !DB ::getDriverName () == 'pgsql ' ) {
130122 $ errors [] = 'Error: PHP mysqli extension not activated ' ;
131123 }
132- if (!extension_loaded ('json ' )) {
133- $ errors [] = 'Error: PHP json extension not activated ' ;
134- }
135- if (!extension_loaded ('zip ' )) {
136- $ errors [] = 'Error: PHP zip extension not activated ' ;
137- }
138124
139125 // Permissions
140- if (Helpers::hasPermissions (Storage::path ('big ' )) === false ) {
141- $ errors []
142- = 'Error: \'uploads/big \' is missing or has insufficient read/write privileges ' ;
143- }
144- if (Helpers::hasPermissions (Storage::path ('medium ' )) === false ) {
145- $ errors []
146- = 'Error: \'uploads/medium \' is missing or has insufficient read/write privileges ' ;
147- }
148- if (Helpers::hasPermissions (Storage::path ('small ' )) === false ) {
149- $ errors []
150- = 'Error: \'uploads/small \' is missing or has insufficient read/write privileges ' ;
151- }
152- if (Helpers::hasPermissions (Storage::path ('thumb ' )) === false ) {
153- $ errors []
154- = 'Error: \'uploads/thumb \' is missing or has insufficient read/write privileges ' ;
155- }
156- if (Helpers::hasPermissions (Storage::path ('import ' )) === false ) {
157- $ errors []
158- = 'Error: \'uploads/import \' is missing or has insufficient read/write privileges ' ;
159- }
160- if (Helpers::hasPermissions (Storage::path ('' )) === false ) {
161- $ errors []
162- = 'Error: \'uploads/ \' is missing or has insufficient read/write privileges ' ;
126+ $ paths = ['big ' , 'medium ' , 'small ' , 'thumb ' , 'import ' , '' ];
127+
128+ foreach ($ paths as $ path ) {
129+ if (Helpers::hasPermissions (Storage::path ($ path )) === false ) {
130+ $ errors []
131+ = 'Error: \'uploads/ ' . $ path . '\' is missing or has insufficient read/write privileges ' ;
132+ }
163133 }
164134 if (Helpers::hasPermissions (Storage::disk ('dist ' )->path ('user.css ' ))
165135 === false
0 commit comments