Every time someone goes to the settings page (or perhaps all admin pages) admins should be reminded about what version of the program they are currently running. It really shouldn't be a big deal, but it does need to be consistently applied.
The variables table table should just store the version of the last known release. This could be accessed by the upgrade scripts too to make upgrading way easier. For the same measure admins could be alerted when there is a major security issue with their version of the script.
There has to be a better way to find out what version of drupal you are using than checking the changelog to find what was the last entry in it.
It would be useful to be able to track if their database config is up2date or if tables/fields are missing..
It offers no performance problems.. So let's do this for the 4.7 release! This has probably been discussed 1000 ways before, but it should be something easy to add (if only in mysql for now) so that there is a reference point for the 4.7 series.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | system.module.patch2 | 935 bytes | mgifford |
| #13 | system.module_20.patch | 770 bytes | mgifford |
Comments
Comment #1
jjeff commented+1 on the concept.
So you're saying that the update script would put a new version number into the db? Good idea.
Let's see some code.
Comment #2
chx commentedWe probably need a small array of schema => releasename. Schema is already in database...
Comment #3
markus_petrux commenteddrupal.module already has a constant with the version number. I'm not sure what this means, though.
Comment #4
mgiffordWhere is the schema presently in the db? I was looking in the variable table and couldn't find it.
As far as code, somehting like this would work fine I think:
/* Why text and an ID? Well, the text is easier for the user to
* read and understand while the build ID, being a number (a date
* with a serial, specifically), is easier for the developer to use
* to determine newer/older versions for upgrade and installation
* purposes.
*/
$the_current_ver = array('text' => '4.7r3', 'build' => 2006012101);
variable_set('drupal_version', $the_current_ver);
It's following the examples from the modules. I couldn't find a reference to the string version in drupal.module.. Maybe it is somewhere else though..
Mike
Comment #5
fax8 commented+1 for the idea. useful also for users when needs to upgrade after a security hole.
Also displais this informations on the admin page. Maybe just before the line
"Welcome to the administration section. Below are the most recent system events."
Comment #6
Crell commentedI agree that it should be easier to know the version you're running, but it should also be hidable. Some consultants like to be able to completely self-brand the system, and having it say "Drupal 4.x" in big letters makes that a wee bit more difficult. :-)
Comment #7
killes@www.drop.org commentedPeople who'd like to lay claim to our work should be educated with pointy sticks.
Comment #8
mgiffordDrupal keeps thinking that my submissions are suspicious.. So I lost my last post.
Not sure if these are useful but I have been told in the past that a metatag like this could be useful:
meta http-equiv="generator" content="Drupal.org v 4.7.0"
Whatever code we put in to alert folks about what version of Drupal they are using, someone could rip it right out. It just shouldn't be made easy. If someone wants to provide a Drupal Distro like say Bryght or CivicSpace then they can modify the script to spit out their version numbers. That's fair as far as I'm concerned, it's not like they are trying to hide a connection to the core code base.
They may well find it benificial to list the Drupal version they are building on too. CivicSpace 0.8.2 (built on Drupal 4.6.5rc3).
The default should just remind people regularly what version of drupal they are using. I can't see any down sides to this, and lots of advantages.
Mike
ps. +1 on the pointy sticks!
Comment #9
fax8 commentedmgifford: don't you think that having version number public available
(in a meta tag) could be a security issue?
Think about the version used is a bugged one that hasn't been patched..
Displaying version number to everybody could make a cracker life really easier..
I think that display version number on the administration page could be enought.
About consultant which want to hide informations: maybe we can wrap version
number in a theme('version', $version) and let themers override that function.
Comment #10
mgiffordYeah, the metatags are definitely more of a tricky issue. Probably more issues with that than we'd want to explore here.
I'd really be quite happy if there was even an agreement to just keep updating the db with every release with something like:
$the_current_ver = array('text' => '4.7r3', 'build' => 2006012101);
variable_set('drupal_version', $the_current_ver);
How it is displayed/used can be debated, discussed & determined later. Let's just get agreement on the numbering system & keeping that number relevant.. Then we can think about what should be done with it.
There must be some previous conversations about this.. Any idea where the threads can be found and why they weren't included?
Seems like some modules are using them, but not consistently..
Mike
Comment #11
Bèr Kessels commentedeight people who think this is a good idea. right. So where is the code. As killes points out, saying that something is needed, does not solve anything.
We all *know* that we need this. So, code it. :)
Comment #12
markus_petrux commentedI think it would be nice if anything done in this direction can also be used by contrib modules/themes.
Imagine that core and contrib stuff includes a file named "item.version". This file could include the item name, version, date and maybe more information such as dependencies, etc.
For core, you could print this information somewhere on an admin panel (maybe admin/settings). For modules, in admin/modules and for themes in admin/themes.
Then, the project module could generate some kind of feed with that information for latest released version. So that feed could be retrieved from Drupal sites and could be used to mark in red (or something) out dated items in admin/settings, admin/modules and admin/themes.
An additional benefit of such "item.version" files could be that there would be no need to load PHP stuff when looking for modules, which would safe a lot of memory requirements only to visit admin/modules.
The format of the "item.version" file could be XML, which seems suited for transfering information across systems.
Comment #13
mgiffordHere's a patch for the admin/settings page.
Seems to work well enough.. Would be better to have a constant or something though in a more accessible place mind you..
However, be interested in seeing other options.
Also, like the idea of extending this to modules.. Where the core goes, the modules will eventually follow though..
Mike
Comment #14
Bèr Kessels commentedYour if empty is unneeded. variable_get('drupal_version', array('text' => '4.7r3', 'date' => '20060130')) will fill the var, if it is not set yet.
WE also really need a variable_set in the update.inc, though.
Comment #15
markus_petrux commentedWouldn't it be better to place version information on a common central place? There's already a constant in the drupal module. ...or is that a completely different story?
Comment #16
Crell commentedI wasn't suggesting that we aid and abet people in misrepresenting Drupal as all their own work. (Hell, I can recognize Drupal by its URLs these days.) But one of Drupal's big advantages is how brandable it is. I think it was Dries (although I'm not sure of that) who commented once that you can run a Drupal site without the word "Drupal" apearing in it anywhere, which was a good thing. I agree, and that's a feature we should keep.
Short-term, the theme() function sounds like an interesting approach. Long-term, we really need better versioning declaration for both Drupal core and contrib modules. +1 on keeping that information limited to the admin area, though, for security reasons.
Comment #17
mgiffordI don't know what the workflow is for putting out releases & release candidates..
I'd just want to make sure that it is somewhere that is hard to miss so that whoever is doing the updates doesn't skip a release.. That would be bad..
thanks Ber for the shorter code!
Mike
Comment #18
dries commentedThere is version defined in drupal.module:
define('VERSION', '4.7.0');
This code needs to be cleaned up.
Comment #19
mgiffordI never have the drupal distributed login enabled, so this is never called:
define('VERSION', '4.7.0');
Can it go into a manditory file like the system.module?
This also doesn't capture dates, cvs versions or release candidate info.. I've tried to incorporate the previous suggestions into the latest patch.
Mike
Comment #20
markus_petrux commentedYou would have to fix drupal.module as well (remove the VERSION constant definition).
I believe these constants ought to be defined on a global file, maybe bootstrap.inc?
Also, what do VERSION_DATE VERSION_CVS mean? Which file do they refer to?
And how to you plan to keep this information up to date? Which events should trigger changes in these constants? Probably this needs some kind of documentation.
Comment #21
markus_petrux commentedComment #22
mgifford+1 on nixing the define from the drupal.module & moving the constants to bootstrap.inc. It should really be outside of the modules directory so it can't be as easily skipped in an upgrade.
As far as the version date/cvs I was just trying the example in textile:
function _textile_version() {
/* Why text and an ID? Well, the text is easier for the user to
* read and understand while the build ID, being a number (a date
* with a serial, specifically), is easier for the developer to use
* to determine newer/older versions for upgrade and installation
* purposes.
*/
return array('text' => '4.6r1', 'build' => 2005032101);
} // function _textile_version
VERSION_DATE -- The date of the build
VERSION_SVN -- Ok.. Hard to do this with cvs.. With subversion it would make more sense.. I was going to pull in the version number of the file containing the constants. This would at least give a reference point. What would be the most accurate way to put in sub-release or cvs updates?
Comment #23
markus_petrux commentedNot sure how the LICENSE.txt file gets inserted into packages, but that process could also generate a file named VERSION, maybe in XML format (easier to extend). Then you need a function to parse that file and decide where do you wish to print it out.
Benefit is what you do for core, also works for contrib stuff.
At a later time, an additional "feature" could be added. Let's say these files are stored on a central server too, for all project releases. Well, you could add a cron step in drupal core, so drupal based sites could compare their VERSION files with latest releases, so admins could easily know when they have installed outdated packages.
Comment #24
Bèr Kessels commentedplease check the installer system. It will need .install files for all projects. That file will contain a version.
Comment #25
mgiffordThis issue has just kinda died.. I think that there has been a pretty simple solution that could be incorporated into the next 4.7 release which would help settle things for future releases of Drupal.
I'd be happy if there was just agreement to stick in the sql now and settle exactly how it would work into the release workflow later. However, I believe that there is general agreement that it is needed and could really help for 4.7 standardization.
So I don't know enough about the installer system to do much on Ber's last point. Don't want that to stop the momentum that has been generated on this simple addition.
Comment #26
liquidcms commentedok, Mike (mgifford) and i starting chatting on Skype about his (and others i guess) idea about version control... he asked for my $0.02 worth... so i went off on a "rant".. and came up with what i think might be a couple pretty powerful ideas...
Mike figured i should post my suggestions here... so a bit messy .. biut here it is... Mike's comment are still quoted with his name... but name stamps have been removed..
Perhaps.. if i get a chance to mock something up... will repost as a new project ????
============================
well after a quick read.. my $0.02 worth (and i always have an opinion) would be to have module ver numbers pulled out and shown in admin/modules
and possibly include a couple things listed in same location like bootstrap.inc
would simply need to set module DEFINEs in the module and stat that as part of std module development
then have those read when other mod info is read to build admin/mods page
i would have said simply key off CVS string on top at to of module... but they dont seem to make sense here... but they could if drupal cvs set up differently.. currently my 4.7 drupal.mod shows VER = 4.7.0 (which isn't that accurate since it is post beta4
and CVS v = 1.116
possibly could show both, i guess, but likely not needed
and only admins who can admin/modules will have visibility
i bet an hour or 2 of code to pull out cvs "v" from modules
which is maybe more detail than required.. but likely better in many ways than simply having a manually edited DEFINE with no detail.. like 4.7.0 ... which is clearly not up to date.
then there could be the concept of a CIL... ex-Nortel term... compatible issue lineup
which would map the versions of core modules to a release...
EG - Version 4.7Beta4 would = drupal.mod 1.116, blog.mod 1.54, story.mod 1.34, etc....
ok.. maybe more than my $0.02 worth.. but hey... you asked.. well sort of asked
ok.. i got more.....
so drupal.org would need to publish a txt file with the lineup that matches a release.. like the CIL i just suggested.. then code to display mod versions could key off that file and highlight on the admin/module page any module that doesn't match release
these things are all pretty simple.... just not sure that is what anybody wants.. but i would sure find it useful
conceivably modules could spawn from this to do things like what CivicSpace does.. you could "stamp" your own version number to any set of modules and replace the CIL.txt file with this.. you could now see what modules are/aren’t part of YOUR release and which are not at correct release
i think the only parts of this required by core are: publishing of CIL, addition to admin/module page
everything else like add-ons later... like highlighting out of version modules or stamping releases
ok... done.. again..
Mike Gifford: 16:24:06
Totally like this idea "numbers pulled out and shown in admin/modules"
oh.. ok.. thought maybe i was missing the point here :)
Mike Gifford: 16:25:00
There is at least one module that shows the cvs string as the version.. Not sure which one, at the moment mind you..
since i have so much free time on my hands.. maybe i'll hack up something later.. can't be too hard
i think the REALLY cool part of this would be the highlighting of versions out of line... and stamping a release...
that way developers can have their own release control
with their own module lineups..
Mike Gifford: 16:27:02
You gotta put this thread down on the forum or issue tracker somewhere
Comment #27
john.money commentedI haven't had time to create a proper addon module for this yet, but here is what I did for a very limited version control in the system module which I needed as I am in the (long overdue) process of upgrading a couple sites from various versions of Drupal and converting from other legacy CMS implementations. I say very limited because it is only looking at the .module and not any of the countless other files that periodically require updating.
It reads the first couple lines of each module and parses the cvs line. The benefit of this approach is that nothing has to change, all existing modules work, the problem is that its slower and more cumbersome than it needs to be. I also like to see which modules are in core (I forget) vs modules directory vs sites subfolder so it adds css tagging where I can add an icon. Future plans for this were to indicate which modules have SQL tables associated with them and possibly check the cvs status on drupal.org
In function_system_modules()...
In theme_system_modules()...
at end of file, add...
Comment #28
ChrisKennedy commentedThis is fixed in cvs via .info files and admin/logs/status.
Comment #29
(not verified) commented