Example #1
0
	def _install_plugin(self):
		"""Installs and activates the plugin."""

		# Copy the plugin's source to the blog
		source_dir = get_template_dir(os.path.join('pressgang/lockdown/cache', self._PLUGIN_DIR_NAME))
		if not source_dir:
			raise LockdownError(_("Unable to find the source for the WP Super Cache plugin in any of the template directories."))
		try:
			shutil.copytree(source_dir, self._install_path)
		except OSError, e:
			raise LockdownError(_("Unable to copy the plugin source from %(from)s to the blog at %(to)s.") % {'from': source_dir, 'to': self._install_path}, e)
Example #2
0
	def execute(self, blog, lockdown):
		"""Disable most interactive features of the blog."""

		# Get the source and destination directories for the plugins
		dest_dir = os.path.join(blog.plugins_path, self._WP_PLUGINS_DIR)
		source_dir = get_template_dir('pressgang/lockdown/plugins')
		if not source_dir:
			raise LockdownError(_("Unable to find the lockdown plugins in any of the template directories."))

		# Create a sane baseline by removing old plugins
		self.start(_("Removing old plugins."))
		if os.path.isdir(dest_dir):
			try:
				shutil.rmtree(dest_dir)
			except OSError, e:
				raise LockdownError(_("Unable to remove the old plugins from %(path)s.") % {'path': dest_dir}, e)