WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#42383 closed feature request (duplicate)

Creating "Frameworks" in "wp-content"

Reported by: tazotodua Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

I had an idea, just i dont know if it's worth to do or not...

well, lets say there are many frameworks (like Visual-Composer, Gantry or many other PHP libraries and frameworks).

On WordPress repository, maybe thousands of themes/plugins use the same package...
Thus while I have 20 plugins and 5 themes installed on my site, i have same library installed 5-10 times (in individual plugin/theme folders).

Also, when framework is updated, then all of the plugin/theme developers manually submit those changed files to SVN... and that makes tracing more complex...

What if WordPress created a flexible repository for Frameworks/libraries, that can be called from plugins/themes easily. For example, in "my-xyz-plugin".

<?php
/*  
   Plugin Name: My XYZ Plugin
   ....
*/

wp_include_framework('visual-composer', '4.15');

...
...
?>

so, the "wp_include_framework" should be native WP function, which will do the following (phseudo-code):

function wp_include_framework($name, $version){
    //check if folder doesnt exist
    if(!is_dir(ABSPATH.'/wp-content/frameworks/visual-composer/4.15/')){
       download_and_unzip("svn.wordpress.org/frameworks/visual-composer/4.15.zip");
    }
    include_once(ABSPATH.'/wp-content/frameworks/visual-composer/4.15/loader.php');
}

So, whenever plugin/theme is updated, the SVN only gets update of 1 line in plugin/theme PHP code, instead of updating whole library file ( authors of thousands of plugins and themes doing the same thing).

I dont know what "cons" does this idea have.
p.s. if someone need to explicitly include the library into own plugin/theme folder, he can still do that of course.

Change History (4)

#1 @tazotodua
4 years ago

p.s. once in a while, wp-cron-job can loop thought active plugins and delete all folders in wp-content/frameworks/* which are not used in any active plugins by the function wp_include_framework.

#2 @tazotodua
4 years ago

similar thing with js libraries...

I think that will make things more standartized...

#3 @swissspidy
4 years ago

  • Component changed from General to Plugins
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I think we can roll this under the same discussion going on over in #22316. It's all about dependencies after all. Please feel free to weigh in over there :-)

#4 @SergeyBiryukov
4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.