-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iks branch merge #50
Iks branch merge #50
Changes from 78 commits
590e077
58b6c0c
20f3979
cd53ea4
0e96f74
2c299e9
1848d18
7041d0c
fca6278
e42dcfd
e7546d3
e0f970f
8110c2a
13f666d
3b96def
a557cdf
7621f95
5dc8d14
7f201c6
cac7fa6
151e0c3
a4dffea
5f63ed0
9675131
6dffdb0
63ac2ce
1500e48
c75f4ac
9556cdf
c85c418
7285291
d0c1418
9d2aac5
fb2b4bc
7eca9fa
8f16826
9236808
9164993
5060caa
5deb866
c94e453
6766f3d
da2c4f9
376fbd3
520b0b8
5af67ea
d59fbd7
70eefb9
eeb8644
632037d
f320b8c
1dcd4dc
5ac8675
9d7718d
1ff44df
f857450
1f007d8
2fb05e0
04bc953
6b90bed
77941c5
77427b2
bae0912
ab0b939
4128afc
c70358d
fd5ba4a
874a957
d072623
b1fb7fe
d4a706e
47f611c
12aa6d3
2e95d97
13dd45d
bc10a36
53eaea7
4efa731
18610a8
2937c1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ app/config/parameters.yml | |
nbproject | ||
.idea | ||
vagrant/.vagrant | ||
.DS_Store |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
symfony 632077aa819d0321e74a2f1b9d388af88bdcac0d | ||
symfony ffddddb3ea7c03ac15f9e7725eb0b3aaa8bc26a6 | ||
twig 30929fde86f5ee12c863a3b572b0457ce52c140b | ||
monolog b704c49a3051536f67f2d39f13568f74615b9922 | ||
MonologBundle 289442e385e7c0fe4aa2e8884d11e774a8f9ad99 | ||
doctrine-common d62352cc721fd05001eacdf0b527a142d3219e0f | ||
jackalope 151cf1c4d88bd4daba521df6e947f80adc524f12 | ||
jackalope-jackrabbit a8043d466f7bb62ac9b9916fdf74df9ddbe741ab | ||
jackalope-doctrine-dbal caec879788519cc6d0f9cfc2483e5b242c60f298 | ||
jackalope 6dc23881a12d3f98ce6cef240efd60e83c4caa12 | ||
jackalope-jackrabbit fa1f7e97f6041cf103cafcf122dd96b618895e1f | ||
jackalope-doctrine-dbal f80826ace27bda81eea5f96cc1bb45ad6378775b | ||
DoctrineBundle 90e39fb7ff5b4c13577602dab7e08c90067160b4 | ||
doctrine-dbal 220a5b0a05214d19dceea01e648d1413bba243c3 | ||
doctrine-dbal d9c3509e8d8fd8cb3887930c1d701ec118579289 | ||
doctrine 1b2b831febb780d8153bc4f8684baa763dd8f177 | ||
phpcr 09b07493dc60a45ce69108eb60f3eec50f8d9dd8 | ||
phpcr-utils 992b32af975ec7c3a3eb0032aa812487ea7172d4 | ||
doctrine-phpcr-odm 4c015c6aa48f58d0c35303e648c98d3810f098f7 | ||
DoctrinePHPCRBundle d221cd28dbb5287224b785b9e51fc1d59b3cfad1 | ||
phpcr 45bb7a8bbfbf175afb5abe64f115a9c5c8e454a2 | ||
phpcr-utils c9c4dcef8f3da099550a66d94120b68ed7dbfc1e | ||
doctrine-phpcr-odm c4fc642c872e0eef699c50beeae90b821ea7cfbc | ||
DoctrinePHPCRBundle 7213f0b8b02481b8d2811c0d488061dcf8b94081 | ||
DoctrineFixturesBundle 0e4e56b1da7981bcc7729e0f301a75195d34df18 | ||
doctrine-data-fixtures aea0b95a554188892f10d8f09ce3ae8150f28f8b | ||
swiftmailer 982b4c9498b7dd85e70f6d35e65d909c888e6345 | ||
|
@@ -21,19 +21,19 @@ assetic 2634d29cc193981761e3daf28e1afc6358bb43b1 | |
twig-extensions 1dfff8e793f50f651c4f74f796c2c68a4aee3147 | ||
metadata 84088bc4f6e2387ec8b549bffc1e037107572f5a | ||
AsseticBundle b9cff021abc3d9433a892fa9908d9856393c0d09 | ||
FunctionalTestBundle a4ec2097dc375eb81e46c8608f920c7069414548 | ||
FunctionalTestBundle 14a4ee55fc49757f44382d15486f7c5e3eb9c3f6 | ||
VieBundle 0433d0fa6051e78bae872f1caeb213bc89cb8409 | ||
FOSRest 5eb800bd63ba84e5fc7028386cb66373bc3efafc | ||
FOSRestBundle c95088f6207e37afbfa24c9c81b62baca5f4ef89 | ||
FOSRestBundle c11ab9d990a1e0e979b1c8ab72cc9793b4b2dcb5 | ||
FOSJsRoutingBundle bc61ffe5c4186a8ac206a8c68de221bc48e8a436 | ||
JMSSerializerBundle 27fbaafc4dcfa7dae2160b4efde5f8543e2bc3f4 | ||
knp-menu f818c58d89885c5eb1e305f5b7360588fd49fbab | ||
KnpMenuBundle 462b7b40e5c17813a6d14929d7bca7d0511c7736 | ||
symfony-cmf 247292f8a357414df036ea6cc5d1e08de826b8fb | ||
JMSSerializerBundle 93d9e6d50d6901632b6d5fa2280718733ce9c4f2 | ||
knp-menu f7970583d4da8776c037e2d49878d8160361e373 | ||
KnpMenuBundle c20933d2b988a3bd0944a0fd9e00068c30f0d27f | ||
symfony-cmf 6e1e3eb018ee8b14eb39cb153b6119f0da1164ed | ||
ChainRoutingBundle edd9f9544eadedb142fefd3ea9bb0c3b293c59d5 | ||
SonataCacheBundle f82a6d42052b226b09e16a0b7d519ee8906c6cdc | ||
SonataBlockBundle ff34c3fe75bcedc739f3d4f8ad7f0a3b840b75e4 | ||
SonatajQueryBundle 01ffb8d1a7a4bb3971aed003e4f1ef050a0701aa | ||
SonataAdminBundle 89b8a91ed81e555bf668947631718f4838ca1186 | ||
SonataAdminBundle abf2df4642937f063936f3a9de328ea12b20113c | ||
SonataDoctrinePHPCRAdminBundle beb8d31ac03a89c811f25ecde18dbe3e3d31cf48 | ||
TreeBundle 10e8c1b15902990f51e62a2f94bf7cacaa956074 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this the update to latest versions of all those? i assume that our branch had very outdated versions? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
|
||
# use * for newest available locally | ||
RABBITVERSION="2.4.0" | ||
|
||
# one per line | ||
MIRRORS="https://s3-eu-west-1.amazonaws.com/patched-jackrabbit/ | ||
http://mirror.switch.ch/mirror/apache/dist//jackrabbit/$RABBITVERSION" | ||
|
||
action="$1"; shift | ||
args="$*" | ||
|
||
pidfile=${TMPDIR:-/tmp}/jack.pid | ||
|
||
JAR= | ||
|
||
usage() { | ||
echo "usage: $(basename $0) <action> [args]" | ||
echo | ||
echo "actions:" | ||
echo -e " start\t\tStarts jackrabbit in the background with the given arguments" | ||
echo -e " stop\t\tStops jackrabbit" | ||
echo -e " restart\tRestarts jackrabbit" | ||
echo -e " status\tPrint current status of jackrabbit (running, stopped)" | ||
echo -e " log\t\tTails the logfile" | ||
echo -e " clear\t\tResets index" | ||
echo -e " flush\t\tWipes the db" | ||
echo -e " flush:article\tRemoves today's articles (alternatively, use 'all' for removing all articles or pass the subpath to delete, e.g., '2011/04/26')" | ||
|
||
} | ||
|
||
if [ -z "$action" ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
# kills jackrabbit and sleeps till process dies | ||
# prints the id of the process previously active process (or empty if it wasn't running) | ||
stop_jackrabbit() { | ||
local id=$(cat $pidfile 2>/dev/null) | ||
|
||
if [ -n "$id" ]; then | ||
kill $id 2>/dev/null | ||
|
||
# wait till process dies | ||
kill -0 $id | ||
while [[ $? -eq 0 ]]; do | ||
sleep 1 | ||
kill -0 $id 2>/dev/null | ||
done | ||
fi | ||
rm -f $pidfile | ||
echo $id | ||
} | ||
|
||
verify_jackrabbit() { | ||
local name="jackrabbit-standalone-$RABBITVERSION.jar" | ||
JAR="$(ls -1 $name 2>/dev/null | tail -n 1)" | ||
|
||
if [ -z "$JAR" ]; then | ||
if [ "$RABBITVERSION" = "*" ]; then | ||
echo "No file found matching $name" | ||
echo "Get it at http://mirror.switch.ch/mirror/apache/dist/jackrabbit/" | ||
exit 1 | ||
fi | ||
|
||
read -p "$name not found. Download? [y/N] " | ||
echo | ||
if [[ ! $REPLY =~ [Yy] ]]; then | ||
exit | ||
fi | ||
JAR="$name" | ||
|
||
echo "Be patient, this might take a minute..." | ||
for m in $MIRRORS; do | ||
url="${m%/}/$name" | ||
echo -n "Downloading from $url" | ||
code=$(curl -w %{http_code} -s $url -o jackrabbit.jar.tmp) | ||
if [ $code != "200" ]; then | ||
echo " [FAILED: $code]" | ||
continue | ||
fi | ||
echo " [OKAY]" | ||
mv jackrabbit.jar.tmp $name | ||
done | ||
rm -f jackrabbit.jar.tmp | ||
fi | ||
} | ||
|
||
# starts jackrabbit in the background | ||
start_jackrabbit() { | ||
|
||
verify_jackrabbit | ||
|
||
if [ -e "$JAR" ]; then | ||
|
||
# already running? | ||
if [ -e $pidfile ]; then | ||
echo "jackrabbit seems to be running ($pidfile)" | ||
echo "Use \`jack restart\` or \`jack stop\`" | ||
exit 1 | ||
fi | ||
|
||
echo "Starting in the background using: $JAR" | ||
java -Xmx512m -Xms512m -jar $JAR $args & | ||
echo $! > $pidfile | ||
|
||
else | ||
echo "File not found: $JAR" | ||
exit 1 | ||
fi | ||
} | ||
|
||
status_jackrabbit() { | ||
if [ ! -e $pidfile ]; then | ||
echo "Not running ($pidfile not found)" | ||
else | ||
echo "Running ($pidfile says $(cat $pidfile))" | ||
fi | ||
} | ||
|
||
|
||
case "$action" in | ||
clear) | ||
wasrunning=$(stop_jackrabbit) | ||
rm -rf jackrabbit/repository/index | ||
rm -rf jackrabbit/workspaces/nzz/index | ||
rm -rf jackrabbit/workspaces/nzz_test/index | ||
echo 'Cleared repository and workspace.' | ||
[ $wasrunning ] && start_jackrabbit | ||
;; | ||
flush:article) | ||
[ -z $args ] && args=$(date +%Y/%m/%d) | ||
[ $args = "all" ] && args="" | ||
# TODO extract port from $args | ||
curl -X DELETE http://admin:admin@localhost:8080/server/nzz/jcr:root/article/$args | ||
;; | ||
|
||
flush) | ||
read -p "This will truncate the DB. Continue? [y/N]" | ||
if [[ ! $REPLY =~ [Yy] ]]; then | ||
exit | ||
fi | ||
wasrunning=$(stop_jackrabbit) | ||
rm -rf jackrabbit/repository/datastore | ||
rm -rf jackrabbit/repository/index | ||
rm -rf jackrabbit/workspaces/nzz/index | ||
rm -rf jackrabbit/workspaces/nzz/db | ||
rm -rf jackrabbit/version | ||
echo 'Flushed repository and workspace.' | ||
[ $wasrunning ] && start_jackrabbit | ||
;; | ||
|
||
flush:test) | ||
read -p "This will truncate the test DB. Continue? [y/N]" | ||
if [[ ! $REPLY =~ [Yy] ]]; then | ||
exit | ||
fi | ||
wasrunning=$(stop_jackrabbit) | ||
# rm -rf jackrabbit/repository/datastore | ||
# rm -rf jackrabbit/repository/index | ||
rm -rf jackrabbit/workspaces/nzz_test/index | ||
rm -rf jackrabbit/workspaces/nzz_test/db | ||
rm -rf jackrabbit/version | ||
echo 'Flushed repository and workspace.' | ||
[ $wasrunning ] && start_jackrabbit | ||
;; | ||
|
||
register) | ||
app/console doctrine:phpcr:register-system-node-types --allow-update | ||
app/console doctrine:phpcr:register-node-types ./script/nzz_unstructure.cnd --allow-update | ||
;; | ||
log) | ||
tail -f jackrabbit/log/jackrabbit.log | ||
;; | ||
stop) | ||
stop_jackrabbit >/dev/null | ||
;; | ||
restart) | ||
stop_jackrabbit >/dev/null | ||
start_jackrabbit | ||
;; | ||
start) | ||
start_jackrabbit | ||
;; | ||
status) | ||
status_jackrabbit | ||
;; | ||
|
||
*) | ||
echo "Unknown action: $action" | ||
usage | ||
exit 1 | ||
esac | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like a duplication of https://github.com/sixty-nine/Jackrabbit-startup-script |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
namespace Sandbox\MainBundle\Controller; | ||
|
||
use Sandbox\MainBundle\Document\Image; | ||
|
||
use Doctrine\ODM\PHPCR\DocumentManager; | ||
|
||
use FOS\RestBundle\View\ViewHandlerInterface; | ||
use FOS\RestBundle\View\View; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
|
||
class ImageController extends Controller | ||
{ | ||
protected $dm; | ||
|
||
/** | ||
* @var FOS\RestBundle\View\ViewHandlerInterface | ||
*/ | ||
private $viewHandler; | ||
|
||
protected $images_mime = array( | ||
'image/png', | ||
'image/jpeg', | ||
'image/gif', | ||
'image/bmp', | ||
'image/vnd.microsoft.icon', | ||
'image/tiff', | ||
'image/svg+xml'); | ||
|
||
public function __construct(ContainerInterface $container, DocumentManager $dm, ViewHandlerInterface $viewHandler) | ||
{ | ||
$this->container = $container; | ||
$this->dm = $dm; | ||
$this->viewHandler = $viewHandler; | ||
} | ||
|
||
public function displayAction($id) | ||
{ | ||
$basepath = $this->container->getParameter('symfony_cmf_content.static_basepath'); | ||
|
||
$image = $this->dm->find(null, $basepath.'/'.$id); | ||
|
||
$data = stream_get_contents($image->content); | ||
|
||
$response = new Response($data); | ||
$response->headers->set('Content-Type', 'image/jpeg'); | ||
$response->setPublic(); | ||
|
||
$date = new \DateTime(); | ||
$date->setTimestamp(time() + 332640000); | ||
$response->setExpires($date); | ||
$response->setMaxAge(332640000); | ||
|
||
return $response; | ||
} | ||
|
||
public function uploadAction(Request $request) | ||
{ | ||
$basepath = $this->container->getParameter('symfony_cmf_content.static_basepath'); | ||
$error = false; | ||
$path = ''; | ||
|
||
$files = $request->files; | ||
|
||
$id = ''; | ||
foreach ($files->all() as $file ) { | ||
if (in_array($file->getClientMimeType(), $this->images_mime)) { | ||
$name = $file->getClientOriginalName(); | ||
$path = $file->getPathname(); | ||
$id = md5(time()); | ||
$jcrPath = $basepath.'/'.$id; | ||
if (!$this->dm->find(null, $jcrPath)) { | ||
$image = new Image(); | ||
$image->setPath($jcrPath); | ||
$image->name = $id; | ||
$image->content = file_get_contents($path); | ||
$image->tags = explode(',', $request->get('tags')); | ||
} else { | ||
$error = 'This file already exists in your backend.'; | ||
} | ||
|
||
$this->dm->persist($image); | ||
} else { | ||
$error = "What you're trying to upload is not an image."; | ||
} | ||
} | ||
|
||
$this->dm->flush(); | ||
|
||
return $this->redirect($this->generateUrl('image_display', array('id' => $id))); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably come from the config value of the routing bundle. but thats a viebundle issue, not related to this merge.