Skip to content

Instantly share code, notes, and snippets.

View loftux's full-sized avatar

Peter Löfgren loftux

View GitHub Profile
// To be used with Alfresco JS Console. Select folder in js console to create export package for
var exportaction = actions.create("export");
exportaction.parameters["store"] = "workspace://SpacesStore";
exportaction.parameters["package-name"] = space.properties.name + "_export.acp";
exportaction.parameters["destination"] = space.parent;
exportaction.parameters["include-children"] = true;
exportaction.parameters["include-self"]=true;
exportaction.parameters["encoding"]="UTF-8";
exportaction.execute(space);
#!/bin/bash
# -------
# Script to patch for Imagetragick
#
# Copyright 2013-2016 Loftux AB, Peter Löfgren
# Distributed under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC BY-SA 3.0)
# -------
IMAGEMAGICKPOLICYFILE="/etc/ImageMagick/policy.xml"
// Delete thumbnails if exists. To be used in Alfresco javascript console. Starts from selected space
recurse(space, function(node) {
var doclib = node.getThumbnail('doclib');
var webpreview = node.getThumbnail('webpreview');
var webpreview2 = node.getThumbnail('web-preview');
var imgpreview = node.getThumbnail('imgpreview');
var pdf = node.getThumbnail('pdf');
if(doclib){
doclib.remove();
@loftux
loftux / resetDashboard.js
Created September 11, 2013 12:50
Script to reset user dashboard in Alfresco. Actually two scripts in same Gist. To be used with the Alfresco Javascript console//
//***** Script variant one, fore one user ********
var userid = "userid01";
var searchobj = {
query:'PATH:"/app:company_home/st:sites/cm:surf-config/cm:components/*" AND @cm\:name:"*'+userid+'*"',
language: 'fts-alfresco'
};
var nodes = search.query(searchobj);
@loftux
loftux / AlfrescoMysql2Postgresql.txt
Created February 27, 2013 14:44
Alfresco Mysql to Postgresql migration. This is a simple outline on how to migrate Alfresco from mysql to postgresql.
Prerequisite
One instance of Alfresco on mysql, one postgresl of exactly the same version (schema version).
Step 1. Dump database
mysqldump --port 3306 -u alfresco --password=alfloftux -h 127.0.0.1 --databases alfresco --skip-comments --skip-extended-insert --no-create-db --hex-blob --default-character-set=utf8 --skip-triggers --compact --no-create-info --skip-quote-names > mydump.sql
Step 2. Dump local Postgres schema
You can install a clean version of Alfresco to use as for schema dump
(need to insert command for dump here)
@loftux
loftux / SvnPathToGit.sh
Created January 24, 2013 15:23
Script to convert a specific subversion path to git, ignoring other subversion paths and content. Not tested to handle merges, does not record commits with proper dates (historic dates in commit message). If you want all that there are better tools available.
#!/bin/bash
# Convert a subversion repository path to git
# Author: Peter Löfgren, Loftux AB
# The subversion path to export
URL="https://share-extras.googlecode.com/svn/trunk/Media Preview"
# First revision this path exists
STARTREV=2