For d6 to d7 version conversion it is important to know the core version of a view.

Here is a patch, which adds it.

Comments

merlinofchaos’s picture

Status: Needs review » Needs work

This needs to be updated for the .install file changes recently committed.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new768 bytes

Updated version.

I'm wondering whether

+    'default' => 6,

should be 7 in drupal7 version?

merlinofchaos’s picture

Status: Needs review » Needs work

Hmm.

Let's not set a default in the db, and let's explicitly set it. Because changing the schema is going to require branching our update numbers in an ugly way.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.24 KB

OK Default 0

The core version will be added on adding a view.

dawehner’s picture

StatusFileSize
new1.24 KB

OK Default 0

The core version will be added on adding a view.

dawehner’s picture

Even if this patch gets commited, there might be people which doesn't have created/exported a view after this patch. So $view->core might be empty. Should i respect this and consider that its a 6 views?

This is somehow a push :) I really need this for the conversion api-ui.

dawehner’s picture

Some feedback would be cool. This is afaik badly needed for automatic update of drupal6 to drupal7 views.

bojanz’s picture

Sounds good to me.
If you're doing an update from d6 to d7 and the version is missing, assuming that the view is 6.x is an okay assumption.

dawehner’s picture

Here is a rerole

Do you wish to run all pending updates? (y/n): y
Executing views_update_6013                                                                                                                                           [success]
ALTER TABLE {views_view} ADD `core` INT DEFAULT 0                                                                                                                     [success]
WD php: Strict warning: Non-static method view::load_views() should not be called statically in view::load_views() (line 961 of                                       [error]
/var/www/d6/sites/default/modules/views/views.module).
WD php: Strict warning: Non-static method view::db_objects() should not be called statically in view::db_objects() (line 1375 of                                      [error]
/var/www/d6/sites/default/modules/views/includes/view.inc).
WD php: Strict warning: Declaration of views_plugin_localization::init() should be compatible with that of views_plugin::init() in views_include_handler() (line 90 of[error]
/var/www/d6/sites/default/modules/views/includes/handlers.inc).
'all' cache was cleared                                                                                                                                               [success]
Strict warning: Non-static method view::load_views() should not be called statically in view::load_views() (line 961 of                                               [error]
/var/www/d6/sites/default/modules/views/views.module).
Strict warning: Non-static method view::db_objects() should not be called statically in view::db_objects() (line 1375 of                                              [error]
/var/www/d6/sites/default/modules/views/includes/view.inc).
Strict warning: Declaration of views_plugin_localization::init() should be compatible with that of views_plugin::init() in views_include_handler() (line 90 of        [error]
/var/www/d6/sites/default/modules/views/includes/handlers.inc).
An error occurred at function : drush_core_cache_clear                                                                                                                [error]
Finished performing updates.                                                                                                                                          [ok]
An error occurred at function : drush_core_updatedb                 
dawehner’s picture

StatusFileSize
new1.25 KB

And here is the patch.

dawehner’s picture

Assigned: Unassigned » bojanz

Assign to bojanz for review

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Code looks good. Applies to 2.x and 3.x
Applied patch to 3.x, ran update.php, update completed successfully, existing views had 0 as the core version.
Added new View, core version listed as 6 in the database table, as expected.

This will need porting for 7.x

merlinofchaos’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 2.x and 3.x

NOte that this causes 2.x to skip update 6012 -- which is probably okay. We need to figure out how to make the updates clean across versions.

dawehner’s picture

Status: Patch (to be ported) » Fixed

Ported an commited to the 7.x branch.

I suggest to add 6015 for the next update function in each branch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.