Are there any roles to manage or create multiple wikis? I have checked Manual:Wiki family and understand the normal way of creating multiple wiki in a MediaWiki.
I'd like to share what I got in addition to the manual.
Beside of multiple domains/subdomain you can get also multiple path for multiple wikis. Each will stand with different configuration setup by adding the action path at the end line on each of your setting files as shown:
# End of automatically generated settings.
# Add more configuration options below.
$wgArticlePath = "/map/$1";
$actions = array( 'edit', 'watch', 'unwatch', 'delete','revert', 'rollback',
'protect', 'unprotect', 'markpatrolled', 'render', 'submit', 'history',
'purge', 'info' );
foreach ( $actions as $action ) {
$wgActionPaths[$action] = "$wgArticlePath/$action";
}
$wgActionPaths['view'] = "$wgArticlePath";
Change the map variable to your path on each of the setting files then place them under the folders named exactly follow to your path.
So you can modify the code in the LocalSettings.php similar as below:
<?php
// Include common settings to all wikis before this line (eg. database configuration)
$paths = explode('/' , $_SERVER['REQUEST_URI']);
if($paths[2] === NULL) {$path = 'map';} else {$path = $paths[1];}
switch ( $_SERVER['SERVER_NAME'] ) {
case 'wiki.tophyips.info':
require_once "settings/$path/tophyips.php";
break;
case 'wiki.hyipscript.info':
require_once "settings/$path/hyipscript.php";
break;
case 'wiki.hyipmonitors.info':
require_once "settings/$path/hyipmonitors.php";
break;
default:
header( 'HTTP/1.1 404 Not Found' );
echo 'This wiki is not available. Check configuration.';
exit( 0 );
}
Change the map variable on $path = 'map'; to one of your default path of your choice from all the paths you put on the setting files above.
You may check the result of the configuration above on my wiki family page.
The mediawiki::wiki module is used for creating wikis. Some roles that use it are commons and private (there are surely more). If you just want to create a wiki without any extra configuration, you can just write mediawiki::wiki{<wikiname>:} and put it in puppet/modules/role/manifests/my_role.pp (inside a role block - see other role files for the format) and then you can enable/disable via vagrant roles.
Related
I am using October CMS
I have a model which has some attachOne and attachMany file attachments.
Both of these work fine during normal use.
However I am having difficulty with setting up tests
I have the following code in my test class
$logo = file(__DIR__ . '/assests/images/logo.png');
$file = new System\Models\File;
$file->data = __DIR__ . '/assests/images/Sample-Photo.jpeg';
$file->is_public = 1;
$file->save();
$nhd->developer_logo = (new System\Models\File)->fromData($logo, 'logo.png');
$nhd->development_photos->add($file);
$nhd->save();
$developer_logo_path = $nhd->developer_logo->getPath();
$photo_path = $nhd->development_photos[0]->getPath();
Both the ‘$developer_logo_path’ and ‘$photo_path’ variables successfully return a stored file path ( which actually points to a file which has been saved ) which is what i would except.
However if i then let the test run and execute the normal code. If I put a breakpoint in the component php file at the point after the model referred to in the test code as $nhd has been loaded there is a ‘developer_logo’ attached ( the AttachOne file ) but there are no ‘development_photos’ ( the attachMany file ).
As a result the template also does not output anything when {{component.development_photos}} is used
I also tried using the inline method to add the attachMany file ( $nhd->development_photos = (new System\Models\File)->fromData($photo, ‘logo.png’); ) and this also did not work.
Can anyone help me?
I'm trying to disable all visitor cookies for my Joomla website.
I found some tutorials, but they are for Joomla version:1.x
Any suggestions?
The solution is very similar to solution to remove cookies in Joomla version 1.x and 2.x. So we will use the same condition and principle.
If you change this two files then maybe something other will not work. Change this only if you know what are you doing and if you know that will everyting else work. Because you can break the whole website!
You must edit two files /libraries/src/Application/CMSApplication.php and libraries/joomla/session/handler/native.php
In libraries/src/Application/CMSApplication.php change code around line 166 and add if condition for whole code in method if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){
public function checkSession()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
$db = \JFactory::getDbo();
$session = \JFactory::getSession();
$user = \JFactory::getUser();
// ... rest of code
}
}
In libraries/joomla/session/handler/native.php change code around line 229 add if condition for whole code in method like in previous file
private function doSessionStart()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
// Register our function as shutdown method, so we can manipulate it
register_shutdown_function(array($this, 'save'));
// ... rest of code
}
}
This works in Joomla 3.8.2
Note: after every Joomla update you must edit this two files again and test if this solution still works.
Set the cookie-path "/administrator" in the Admin Joomla Settings (System => Configuration).
Then the session cookies are created only for the admin area.
To avoid all cookies for normal visitors, you need to follow the below steps.
First of all: Deactivate site statistics! Global configuration -> Statistics -> Statistics: No. This will stop the "mosvisitor" cookie.
Don't use the Template Chooser module, because it uses a cookie named "jos_user_template".
Be careful with components: Some might start their own PHP session.
Now to the main point: comment out line 697 of /includes/joomla.php like this:
// setcookie( $sessionCookieName, '-', false, '/' );
Additional: Comment out line 25 in /offline.php:
// session_start();
This seams to be an artifact of old versions.
Do you have any sample codes or functions to check if an image name is existing already in the folder before uploading?
I've tried using file_exists() but it doesn't work, here is my sample code:
$path = FCPATH . "images2/";
$filename=$_FILE['userfile'];
$full_path = $path .$filename;
if(file_exists($filename))
{
///display error message///
}
Here is the simplest way to check if a file exist:
if(is_file($filename){
return true; //the file exist
}else{
return false; //the file does not exist
}
I'm assuming you are not getting the correct result with file_exists() because you don't include the full path (even tho you define it).
Try using the following: file_exists($full_path)
Also consider using some CI helper functions for handling files like images, or uploads. They are there to make this 'easier'.
File helper:
http://ellislab.com/codeigniter/user-guide/helpers/file_helper.html
I am trying to write my very first MediaWiki extension and need some way to debug it. What is the simplest way to do it? Showing a message, logging into a file etc. would be fine. I just want to slowly progress over the code and see where it breaks and what the content of a variable is.
I've tried (from http://www.mediawiki.org/wiki/Manual:How_to_debug#Useful_debugging_functions)
// ...somewhere in your code
if ( true ) {
wfDebugLog( 'myext', 'Something is not right: ' . print_r( 'asdf', true ) );
}
in extensions/myext/myext.php and added to LocalSettings.php
require_once( 'extensions/myext/myext.php' );
# debugging on
$wgDebugLogGroups = array(
'myext' => 'extensions/myext/myextension.log'
);
but then my Wiki doesn't work at all (error 500). With the above code removed from myext.php everything's fine (with $wgExtensionCredits in myext.php, I can see myext in the Special:Version).
Is it the right thing to do (then what is the mistake) or is there a better/simpler way to start with?
500 means you have a syntax error or wrong configuration somewhere. Have you followed the instructions at Manual:How to debug and turned on PHP logging, so you can at least see what is causing the error? Alternatively, take a look at your Apache server log.
Also, you'll want to turn on debugging before you load your own extension!
Add these to LocalSettings.php for debugging:
error_reporting( -1 );
ini_set( 'display_startup_errors', 1 );
ini_set( 'display_errors', 1 );
$wgShowExceptionDetails=true;
$wgDebugToolbar=true;
$wgShowDebug=true;
$wgDevelopmentWarnings=true;
$wgDebugDumpSql = true;
$wgDebugLogFile = '/tmp/debug.log';
$wgDebugComments = true;
$wgEnableParserCache = false;
$wgCachePages = false;
You can log debug messages with wfDebug();
Learn more at https://www.mediawiki.org/wiki/Manual:Structured_logging/en
I ask this question, since I am trying to get the images I have just copied from Domain A to work in Domain B, (which is using the same database).
http://DOMAIN_A/magento/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/b/0/b0041-1.jpg
I think knowing what the 32 character string is, which help me find a good explanation why the images are not being found in the front or backend of Magento after reinstall on DOMAIN B.
RE: Magento version 1.4.0.1
Here's the code that creates that filename path, found in Mage_Catalog_Model_Product_Image:
// build new filename (most important params)
$path = array(
Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath(),
'cache',
Mage::app()->getStore()->getId(),
$path[] = $this->getDestinationSubdir()
);
if((!empty($this->_width)) || (!empty($this->_height)))
$path[] = "{$this->_width}x{$this->_height}";
// add misk params as a hash
$miscParams = array(
($this->_keepAspectRatio ? '' : 'non') . 'proportional',
($this->_keepFrame ? '' : 'no') . 'frame',
($this->_keepTransparency ? '' : 'no') . 'transparency',
($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
$this->_rgbToString($this->_backgroundColor),
'angle' . $this->_angle,
'quality' . $this->_quality
);
// if has watermark add watermark params to hash
if ($this->getWatermarkFile()) {
$miscParams[] = $this->getWatermarkFile();
$miscParams[] = $this->getWatermarkImageOpacity();
$miscParams[] = $this->getWatermarkPosition();
$miscParams[] = $this->getWatermarkWidth();
$miscParams[] = $this->getWatermarkHeigth();
}
$path[] = md5(implode('_', $miscParams));
// append prepared filename
$this->_newFile = implode('/', $path) . $file; // the $file contains heading slash
So, the hash is generated from the configuration info (aspect ratio, etc), as well as the watermark info. This information will not usually change. However, I do see that the path is partially generated from the store_id of the current store, so your trouble may be there.
Is there a reason you can't let Magento use its normal caching procedures for both stores? Since Magento checks the filesystem for the cached image, there shouldn't be a conflict.
Hope that helps!
Thanks,
Joe
Upon contemplation, are you just trying to get the catalog images to work in both domains? The non-cached version of the catalog images are at %magento%/media/catalog/product. Copy the directories from that location and your catalog images should work.
Moving over the cached images isn't going to go far, since they will be deleted next time you flush the Magento cache. So, having moved the images that are in /media/catalog/product, flush the Magento image cache. Make sure that the file permissions are correct for reading. Then, head into Mage_Catalog_Model_Product_Image and take a look at the following code (approx line 270):
if ($file) {
// add these for debugging
Mage::log($baseDir.$file);
Mage::log(file_exists($baseDir.$file));
Mage::log($this->checkMemory($baseDir.$file));
if ((!file_exists($baseDir . $file)) || !$this->_checkMemory($baseDir . $file)) {
$file = null;
}
}
Add a var_dump or Mage::log statement in there (depending on whether you have logging enabled), and verify that the path to the images is correct, and that you have enough memory for the operation. This is the code that will choose the default image for you if no image path exists. If you still can't get it, post the output of those three logging statements and we'll keep trying. :)