Skip to content

Instantly share code, notes, and snippets.

View realityking's full-sized avatar

Rouven Weßling realityking

View GitHub Profile
abstract class JAccessHelper
{
public static function getActionsForAsset($asset, $section = 'component')
{
$user = JFactory::getUser();
$result = new JObject;
$actions = JAccess::getActions($asset, $section);
foreach ($actions as $action)
@realityking
realityking / gist:2775329
Created May 23, 2012 13:49
SQL migration Joomla 3.0
# Drop deprecated columns
ALTER TABLE `#__content` DROP `title_alias`;
ALTER TABLE `#__content` DROP `sectionid`;
ALTER TABLE `#__users` DROP `usertype`;
ALTER TABLE `#__session` DROP `usertype`;
ALTER TABLE `#__users` DROP KEY `whosonline`;
# Change tables for which we want to support foreign keys or transactions to InnoDB
@realityking
realityking / gist:2768598
Created May 22, 2012 11:57
Proposed database changes for Joomla 3.0

This is mostly thinking based on MySQL, we'll have to change the MS SQL version accordingly.

Drop the following fields:

  • #__content.title_alias It's been marked as deprecated since 1.6.0 (?).

Change the following tables to InnoDB:

  • #__banners
  • #__banner_clients
  • #__categories
  • #__contact_details
@realityking
realityking / gist:2314303
Created April 5, 2012 21:30
Joomla! patches that will help with 3.0
@realityking
realityking / gist:1401435
Created November 28, 2011 18:32
Joomla autoloader naming convention
-All classes have to start with a J to be considered by the autoloader
-Class names have to be camel cased
-Every uppercase letter marks a new folder
-If there's only one part it is repetead
Examples:
-JDatabase would have to be in database/database.php
-JDatabaseExporter would have to be in database/exporter.php
-JDatabaseExporterCvs would have to be in database/exporter/cvs.php
@realityking
realityking / gist:1346705
Created November 8, 2011 00:56
index.html creator
#!/usr/bin/php
<?php
if (php_sapi_name() != "cli") {
echo "Error: phptidy has to be run on command line with CLI SAPI\n";
exit(1);
}
function getDirectory($path = '.', $level = 0) {
// Directories to ignore when listing output.