Merge branch 'master' into migration-states

This commit is contained in:
amercader 2015-10-23 10:59:04 +01:00
commit 501edffe2d
4 changed files with 17 additions and 8 deletions

2
.gitignore vendored
View File

@ -8,6 +8,6 @@ build
.DS_Store
dist
development.ini
*.swp
*.sw?
*~
node_modules

View File

@ -1,2 +1,4 @@
recursive-include ckanext/harvest/templates *
recursive-include ckanext/harvest/templates_new *
recursive-include ckanext/harvest/fanstatic_library/styles *
recursive-include ckanext/harvest/public *

View File

@ -29,7 +29,7 @@ Installation
On your CKAN configuration file, add::
ckan.harvest.mq.type = rabbitmq
ckan.harvest.mq.type = amqp
2. Install the extension into your python environment::
@ -149,12 +149,12 @@ Authorization
=============
Starting from CKAN 2.0, harvest sources behave exactly the same as datasets
(they are actually internally implemented as a dataset type). That means that
(they are actually internally implemented as a dataset type). That means they
can be searched and faceted, and that the same authorization rules can be
applied to them. The default authorization settings are based on organizations
(equivalent to the `publisher profile` found in old versions).
Have a look at the `Authorization <http://docs.ckan.org/en/latest/authorization.html>`_
Have a look at the `Authorization <http://docs.ckan.org/en/latest/authorization.html>`_
documentation on CKAN core to see how to configure your instance depending on
your needs.
@ -429,7 +429,7 @@ The ``run`` command not only starts any pending harvesting jobs, but also
flags those that are finished, allowing new jobs to be created on that particular
source and refreshing the source statistics. That means that you will need to run
this command before being able to create a new job on a source that was being
harvested (On a production site you will tipically have a cron job that runs the
harvested (On a production site you will typically have a cron job that runs the
command regularly, see next section).
@ -598,4 +598,3 @@ http://www.fsf.org/licensing/licenses/agpl-3.0.html
.. _Supervisor: http://supervisord.org

View File

@ -140,14 +140,22 @@ def harvest_source_clear(context,data_dict):
delete from resource_group where package_id in
(select id from package where state = 'to_delete');
'''
# CKAN pre-2.5: authz models were removed in migration 078
if toolkit.check_ckan_version(max_version='2.4.99'):
sql += '''
delete from package_role where package_id in
(select id from package where state = 'to_delete');
delete from user_object_role where id not in
(select user_object_role_id from package_role) and context = 'Package';
'''
sql += '''
delete from harvest_object_error where harvest_object_id in (select id from harvest_object where harvest_source_id = '{harvest_source_id}');
delete from harvest_object_extra where harvest_object_id in (select id from harvest_object where harvest_source_id = '{harvest_source_id}');
delete from harvest_object where harvest_source_id = '{harvest_source_id}';
delete from harvest_gather_error where harvest_job_id in (select id from harvest_job where source_id = '{harvest_source_id}');
delete from harvest_job where source_id = '{harvest_source_id}';
delete from package_role where package_id in (select id from package where state = 'to_delete' );
delete from user_object_role where id not in (select user_object_role_id from package_role) and context = 'Package';
delete from package_tag_revision where package_id in (select id from package where state = 'to_delete');
delete from member_revision where table_id in (select id from package where state = 'to_delete');
delete from package_extra_revision where package_id in (select id from package where state = 'to_delete');