|
## general info
|
|
# Useful Documentation
|
|
* class API reference: https://doc.wikimedia.org/mediawiki-core/master/php/index.html
|
|
* class API reference: https://doc.wikimedia.org/mediawiki-core/master/php/index.html
|
|
|
|
|
|
## how to add a parser function
|
|
# how to add a parser function
|
|
|
|
|
|
### write the hook
|
|
## write the hook
|
|
in `MathWikiAnnotationTags.class.php`:
|
|
in `MathWikiAnnotationTags.class.php`:
|
|
```
|
|
```
|
|
public static function onParserSetup( &$parser ) {
|
|
public static function onParserSetup( &$parser ) {
|
... | @@ -13,7 +13,7 @@ public static function onParserSetup( &$parser ) { |
... | @@ -13,7 +13,7 @@ public static function onParserSetup( &$parser ) { |
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
### register the magic words: {{#annot}} and {{#annotend}}
|
|
## register the magic words: {{#annot}} and {{#annotend}}
|
|
in `MathWikiAnnotationTags.i18n.php`:
|
|
in `MathWikiAnnotationTags.i18n.php`:
|
|
```
|
|
```
|
|
$magicWords = array();
|
|
$magicWords = array();
|
... | @@ -23,7 +23,7 @@ $magicWords['en'] = array( |
... | @@ -23,7 +23,7 @@ $magicWords['en'] = array( |
|
);
|
|
);
|
|
```
|
|
```
|
|
|
|
|
|
### register the hook
|
|
## register the hook
|
|
|
|
|
|
in `extension.json`:
|
|
in `extension.json`:
|
|
```
|
|
```
|
... | @@ -35,7 +35,7 @@ in `extension.json`: |
... | @@ -35,7 +35,7 @@ in `extension.json`: |
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
### register the extension in MediaWiki
|
|
## register the extension in MediaWiki
|
|
- place Folder of MyExtension into `/var/www/w/extensions`
|
|
- place Folder of MyExtension into `/var/www/w/extensions`
|
|
- or create a symbolic link: `ln -s /vagrant/MathWikiAnnotationTags/ MathWikiAnnotationTags`
|
|
- or create a symbolic link: `ln -s /vagrant/MathWikiAnnotationTags/ MathWikiAnnotationTags`
|
|
- edit `LocalSettings.php`
|
|
- edit `LocalSettings.php`
|
... | @@ -45,9 +45,8 @@ in `extension.json`: |
... | @@ -45,9 +45,8 @@ in `extension.json`: |
|
- `<?php`
|
|
- `<?php`
|
|
- `wfLoadExtension( 'MathWikiAnnotationTags' );`
|
|
- `wfLoadExtension( 'MathWikiAnnotationTags' );`
|
|
|
|
|
|
## how to create new tables in MediaWiki
|
|
# custom tables in MediaWiki
|
|
|
|
## create SQL file
|
|
### create SQL file
|
|
|
|
|
|
|
|
content of `MyExtension/sql/yata_annotation.sql`
|
|
content of `MyExtension/sql/yata_annotation.sql`
|
|
|
|
|
... | @@ -90,7 +89,7 @@ CREATE INDEX /*i*/yata_annot_category ON /*_*/yata_annotation (category_id); |
... | @@ -90,7 +89,7 @@ CREATE INDEX /*i*/yata_annot_category ON /*_*/yata_annotation (category_id); |
|
COMMIT;
|
|
COMMIT;
|
|
```
|
|
```
|
|
|
|
|
|
### create function which invokes the SQL file
|
|
## create function which invokes the SQL file
|
|
|
|
|
|
in `MyExtension/Schema.php`:
|
|
in `MyExtension/Schema.php`:
|
|
|
|
|
... | @@ -118,7 +117,7 @@ in `extension.json`: |
... | @@ -118,7 +117,7 @@ in `extension.json`: |
|
]
|
|
]
|
|
```
|
|
```
|
|
|
|
|
|
### update the Schema
|
|
## update the Schema
|
|
|
|
|
|
- inside the Vagrant machine (`vagrant ssh`): `mwscript update.php`
|
|
- inside the Vagrant machine (`vagrant ssh`): `mwscript update.php`
|
|
- in production:
|
|
- in production:
|
... | | ... | |