Show More
@@ -53,8 +53,8 b' from rhodecode.lib.middleware.vcs import' | |||||
53 | from rhodecode.lib.plugins.utils import register_rhodecode_plugin |
|
53 | from rhodecode.lib.plugins.utils import register_rhodecode_plugin | |
54 | from rhodecode.lib.utils2 import aslist as rhodecode_aslist |
|
54 | from rhodecode.lib.utils2 import aslist as rhodecode_aslist | |
55 | from rhodecode.subscribers import ( |
|
55 | from rhodecode.subscribers import ( | |
56 |
scan_repositories_if_enabled, write_ |
|
56 | scan_repositories_if_enabled, write_js_routes_if_enabled, | |
57 | write_js_routes_if_enabled, create_largeobjects_dirs_if_needed) |
|
57 | write_metadata_if_needed) | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | log = logging.getLogger(__name__) |
|
60 | log = logging.getLogger(__name__) | |
@@ -305,7 +305,6 b' def includeme(config):' | |||||
305 | settings['default_locale_name'] = settings.get('lang', 'en') |
|
305 | settings['default_locale_name'] = settings.get('lang', 'en') | |
306 |
|
306 | |||
307 | # Add subscribers. |
|
307 | # Add subscribers. | |
308 | config.add_subscriber(create_largeobjects_dirs_if_needed, ApplicationCreated) |
|
|||
309 | config.add_subscriber(scan_repositories_if_enabled, ApplicationCreated) |
|
308 | config.add_subscriber(scan_repositories_if_enabled, ApplicationCreated) | |
310 | config.add_subscriber(write_metadata_if_needed, ApplicationCreated) |
|
309 | config.add_subscriber(write_metadata_if_needed, ApplicationCreated) | |
311 | config.add_subscriber(write_js_routes_if_enabled, ApplicationCreated) |
|
310 | config.add_subscriber(write_js_routes_if_enabled, ApplicationCreated) |
@@ -130,12 +130,12 b' def scan_repositories_if_enabled(event):' | |||||
130 | This is subscribed to the `pyramid.events.ApplicationCreated` event. It |
|
130 | This is subscribed to the `pyramid.events.ApplicationCreated` event. It | |
131 | does a repository scan if enabled in the settings. |
|
131 | does a repository scan if enabled in the settings. | |
132 | """ |
|
132 | """ | |
133 | from rhodecode.model.scm import ScmModel |
|
|||
134 | from rhodecode.lib.utils import repo2db_mapper, get_rhodecode_base_path |
|
|||
135 | settings = event.app.registry.settings |
|
133 | settings = event.app.registry.settings | |
136 | vcs_server_enabled = settings['vcs.server.enable'] |
|
134 | vcs_server_enabled = settings['vcs.server.enable'] | |
137 | import_on_startup = settings['startup.import_repos'] |
|
135 | import_on_startup = settings['startup.import_repos'] | |
138 | if vcs_server_enabled and import_on_startup: |
|
136 | if vcs_server_enabled and import_on_startup: | |
|
137 | from rhodecode.model.scm import ScmModel | |||
|
138 | from rhodecode.lib.utils import repo2db_mapper, get_rhodecode_base_path | |||
139 | repositories = ScmModel().repo_scan(get_rhodecode_base_path()) |
|
139 | repositories = ScmModel().repo_scan(get_rhodecode_base_path()) | |
140 | repo2db_mapper(repositories, remove_obsolete=False) |
|
140 | repo2db_mapper(repositories, remove_obsolete=False) | |
141 |
|
141 | |||
@@ -229,33 +229,6 b' def write_js_routes_if_enabled(event):' | |||||
229 | f.write(jsroutes_file_content) |
|
229 | f.write(jsroutes_file_content) | |
230 |
|
230 | |||
231 |
|
231 | |||
232 | def create_largeobjects_dirs_if_needed(event): |
|
|||
233 | """ |
|
|||
234 | This is subscribed to the `pyramid.events.ApplicationCreated` event. It |
|
|||
235 | does a repository scan if enabled in the settings. |
|
|||
236 | """ |
|
|||
237 | from rhodecode.lib.utils import get_rhodecode_base_path |
|
|||
238 | from rhodecode.lib.vcs.backends.hg import largefiles_store |
|
|||
239 | from rhodecode.lib.vcs.backends.git import lfs_store |
|
|||
240 |
|
||||
241 | repo_store_path = get_rhodecode_base_path() |
|
|||
242 |
|
||||
243 | paths = [ |
|
|||
244 | largefiles_store(repo_store_path), |
|
|||
245 | lfs_store(repo_store_path)] |
|
|||
246 |
|
||||
247 | for path in paths: |
|
|||
248 | if os.path.isdir(path): |
|
|||
249 | continue |
|
|||
250 | if os.path.isfile(path): |
|
|||
251 | continue |
|
|||
252 | # not a file nor dir, we try to create it |
|
|||
253 | try: |
|
|||
254 | os.makedirs(path) |
|
|||
255 | except Exception: |
|
|||
256 | log.warning('Failed to create largefiles dir:%s', path) |
|
|||
257 |
|
||||
258 |
|
||||
259 | class Subscriber(object): |
|
232 | class Subscriber(object): | |
260 | """ |
|
233 | """ | |
261 | Base class for subscribers to the pyramid event system. |
|
234 | Base class for subscribers to the pyramid event system. |
General Comments 0
You need to be logged in to leave comments.
Login now