After exporting a view I get this:
...
$view->api_version = '3.0-alpha1';
...
It should be:
$view->api_version = '3.0';
Because if I implement the hook_views_default_views(), then I doesn't import this view.
See: ctools/includes/export.inc file _ctools_export_get_defaults() function.
// If version checking is enabled, ensure that the object can be used.
if (isset($object->api_version) &&
$object->api_version >= $export['api']['minimum_version'] &&
$object->api_version <= $export['api']['current_version']) {
$cache[$table][$name] = $object;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 1130474-import-validate-version_compare.patch | 1006 bytes | dawehner |
Comments
Comment #1
dawehnerSee views_api_version(); So the interal api version is 3.0-alpha1.
This is really how it should be.
Comment #2
foripepe commentedDereine, I beleive you. But my problem is the exported view is not good for importing. I think it is a huge problem.
I figured out the problem, but not everybody can do that. Lot of people will think this Views module is not enough mature for production sites.
Comment #3
merlinofchaos commentedGood. =beta software isn't mature enough for production sites unless you're really plugged into the code.
That's why we call it beta.
Comment #4
merlinofchaos commentedThat said, the import code should be using version_compare() so yes, there is a bug there.
Comment #5
merlinofchaos commenteddereine tried for awhile to make this break, and can't.
Comment #6
dawehnerHere is a patch for the version compare thing.
We still need a way yo reproduce the bug.
Comment #7
foripepe commentedHow to reproduce:
Views 7.x-3.0-beta3.
Go to admin/structure/views
Choose one view, "Edit" and "Export View".
The textarea has this line: "$view->api_version = '3.0-alpha1';"
Then make a module with a file: {module_name}.views_default.inc
In this module implement a hook: hook_views_default_views()
Put there the content of the textarea.
Insert this module to a new Drupal installation. Turn on the module. You won't see the view.
Then turn off the module. Change the line to: "$view->api_version = '3.0';"
Turn on the module again. The view is there now.
If you need an example module, I can create one to you.
PS. I just noticed, that the api version is "3.0-alpha1", but I use "beta 3".
Comment #8
merlinofchaos commentedThe actual module bit is fixed in CTools -dev a few weeks ago.
You could've saved so much time by just looking at the current code. :/