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;
              }

Comments

dawehner’s picture

Status: Active » Closed (works as designed)

See views_api_version(); So the interal api version is 3.0-alpha1.

This is really how it should be.

foripepe’s picture

Status: Closed (works as designed) » Active

Dereine, 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.

merlinofchaos’s picture

Lot of people will think this Views module is not enough mature for production sites.

Good. =beta software isn't mature enough for production sites unless you're really plugged into the code.

That's why we call it beta.

merlinofchaos’s picture

That said, the import code should be using version_compare() so yes, there is a bug there.

merlinofchaos’s picture

dereine tried for awhile to make this break, and can't.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new1006 bytes

Here is a patch for the version compare thing.

We still need a way yo reproduce the bug.

foripepe’s picture

How 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".

merlinofchaos’s picture

Status: Postponed (maintainer needs more info) » Fixed

The 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. :/

Status: Fixed » Closed (fixed)

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