### 2.2.0 Alpha 1 (XXXX-YY-ZZ)
+* instruction file name for most PIPs has default value now.
* `options` support for cronjobs.
* `name` attribute for cronjob PIP (`cronjobName` for cronjob objects).
* `permissions` and `options` support for event listeners.
</authorinformation>
<instructions type="install">
- <instruction type="packageInstallationPlugin">packageInstallationPlugin.xml</instruction>
- <instruction type="acpMenu">acpMenu.xml</instruction>
- <instruction type="userGroupOption">userGroupOption.xml</instruction>
- <instruction type="option">option.xml</instruction>
- <instruction type="template">templates.tar</instruction>
- <instruction type="eventListener">eventListener.xml</instruction>
+ <instruction type="packageInstallationPlugin" />
+ <instruction type="acpMenu" />
+ <instruction type="userGroupOption" />
+ <instruction type="option" />
+ <instruction type="template" />
+ <instruction type="eventListener" />
<instruction type="script">acp/install.php</instruction>
- <instruction type="cronjob">cronjob.xml</instruction>
- <instruction type="coreObject">coreObject.xml</instruction>
- <instruction type="clipboardAction">clipboardAction.xml</instruction>
- <instruction type="objectTypeDefinition">objectTypeDefinition.xml</instruction>
- <instruction type="objectType">objectType.xml</instruction>
- <instruction type="acpSearchProvider">acpSearchProvider.xml</instruction>
+ <instruction type="cronjob" />
+ <instruction type="coreObject" />
+ <instruction type="clipboardAction" />
+ <instruction type="objectTypeDefinition" />
+ <instruction type="objectType" />
+ <instruction type="acpSearchProvider" />
<instruction type="style">blue-temptation-style.tgz</instruction>
<instruction type="style">woltlab-basic-style.tgz</instruction>
- <instruction type="userOption">userOption.xml</instruction>
- <instruction type="bbcode">bbcode.xml</instruction>
- <instruction type="smiley">smiley.xml</instruction>
- <instruction type="pageMenu">pageMenu.xml</instruction>
- <instruction type="sitemap">sitemap.xml</instruction>
- <instruction type="dashboardBox">dashboardBox.xml</instruction>
- <instruction type="userProfileMenu">userProfileMenu.xml</instruction>
- <instruction type="userMenu">userMenu.xml</instruction>
- <instruction type="userNotificationEvent">userNotificationEvent.xml</instruction>
- <instruction type="aclOption">aclOption.xml</instruction>
+ <instruction type="userOption" />
+ <instruction type="bbcode" />
+ <instruction type="smiley" />
+ <instruction type="pageMenu" />
+ <instruction type="sitemap" />
+ <instruction type="dashboardBox" />
+ <instruction type="userProfileMenu" />
+ <instruction type="userMenu" />
+ <instruction type="userNotificationEvent" />
+ <instruction type="aclOption" />
<instruction type="script">acp/post_install.php</instruction>
</instructions>
</package>
throw new SystemException("unable to find class '".$className."'");
}
+ // set default value
+ if (empty($nodeData['value'])) {
+ $defaultValue = call_user_func(array($className, 'getDefaultFilename'));
+ if ($defaultValue) {
+ $nodeData['value'] = $defaultValue;
+ }
+ }
+
$plugin = new $className($this, $nodeData);
if (!($plugin instanceof IPackageInstallationPlugin)) {
return $this->optionTypeIDs[$optionType];
}
+
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'aclOption.xml';
+ }
}
* @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$className
*/
public $className = 'wcf\data\acp\menu\item\ACPMenuItemEditor';
+
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'acpMenu.xml';
+ }
}
protected function cleanup() {
ACPSearchProviderCacheBuilder::getInstance()->reset();
}
+
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'acpSearchProvider.xml';
+ }
}
}
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'acptemplates.tar';
+ }
+
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
public static function isValid(PackageArchive $archive, $instruction) {
+ if (!$instruction) {
+ $defaultFilename = static::getDefaultFilename();
+ }
+
if (preg_match('~\.(tar(\.gz)?|tgz)$~', $instruction)) {
// check if file actually exists
try {
* Creates a new AbstractPackageInstallationPlugin object.
*
* @param \wcf\system\package\PackageInstallationDispatcher $installation
- * @param array $instruction
+ * @param array $instruction
*/
public function __construct(PackageInstallationDispatcher $installation, $instruction = array()) {
$this->installation = $installation;
$statement->execute(array($this->installation->getPackageID()));
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return null;
+ }
+
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
}
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ $classParts = explode('\\', get_called_class());
+
+ return lcfirst(str_replace('PackageInstallationPlugin', '', array_pop($classParts))).'.xml';
+ }
+
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
public static function isValid(PackageArchive $archive, $instruction) {
+ if (!$instruction) {
+ $defaultFilename = static::getDefaultFilename();
+ if ($defaultFilename) {
+ $instruction = $defaultFilename;
+ }
+ }
+
if (preg_match('~\.xml$~', $instruction)) {
// check if file actually exists
try {
}
}
}
+
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'bbcode.xml';
+ }
}
}
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'files.tar';
+ }
+
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
public static function isValid(PackageArchive $archive, $instruction) {
+ if (!$instruction) {
+ $defaultFilename = static::getDefaultFilename();
+ }
+
if (preg_match('~\.(tar(\.gz)?|tgz)$~', $instruction)) {
// check if file actually exists
try {
*/
public function uninstall();
+ /**
+ * Returns the default file name containing the instructions. If no default
+ * file name is supported, null is returned.
+ *
+ * @return string
+ */
+ public static function getDefaultFilename();
+
/**
* Validates if the passed instruction is valid for this package installation plugin. If anything is
* wrong with it, this method should return false.
*/
protected function findExistingItem(array $data) { }
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'language/*.xml';
+ }
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
);
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'packageInstallationPlugin.xml';
+ }
+
/**
* @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
*/
return $this->installation->getArchive()->getTar()->extractToString($fileindex);
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'install.sql';
+ }
+
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
public static function isValid(PackageArchive $archive, $instruction) {
+ if (!$instruction) {
+ $defaultFilename = static::getDefaultFilename();
+ }
+
if (preg_match('~\.sql$~', $instruction)) {
// check if file actually exists
try {
*/
public $className = 'wcf\data\style\StyleEditor';
- /**
+ /**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::install()
*/
public function install() {
@unlink($filename);
}
- /**
+ /**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
*/
public function uninstall() {
}
}
+ /**
+ * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
+ */
+ public static function getDefaultFilename() {
+ return 'templates.tar';
+ }
+
/**
* @see \wcf\system\package\plugin\IPackageInstallationPlugin::isValid()
*/
public static function isValid(PackageArchive $archive, $instruction) {
+ if (!$instruction) {
+ $defaultFilename = static::getDefaultFilename();
+ }
+
if (preg_match('~\.(tar(\.gz)?|tgz)$~', $instruction)) {
// check if file actually exists
try {